Server setup | xplosionmind Server setup | XPLOSIONMIND

A walktrough the steps I executed to set up my server on Linode.


Spoiler

I started configuring Docker but it has been such a mess that I ended up installing Maadix.



References and resources

CONFIGURATION

update Ubuntu

sudo apt update -y && sudo apt upgrade -y

-y parameter is used to accept by default any question


remove debris

sudo apt autoremove


add a limited user

adduser tommi


give that user sudo permissions

adduser tommi sudo


install zsh

apt install zsh


set zsh as default shell

chsh -s /usr/bin/zsh root


install zsh syntax highlighting

sudo apt install zsh-syntax-highlighting


install git

sudo apt install git


install oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"


enable zsh syntax highlighting

echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc



INSTALL DOCKER

installing

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh


allow Docker to run as a root from this user

sudo usermod -aG docker


enable Docker to start on boot

$ sudo systemctl enable docker tommi



INSTALLING DOCKER COMPOSE

sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose


to enable bash completion, insert in ~/.zshrc

plugins=(... docker docker-compose
)


GETTING STARTED - DOCKER COMPOSE"> GETTING STARTED - DOCKER COMPOSE



LazyDocker

Install Lazydocker to interact easily with Docker. Since it’s written in Go, installation of the language is needed.


download Go

wget -c https://dl.google.com/go/go1.14.3.linux-amd64.tar.gz


extract archive

sudo tar -C /usr/local -xvzf go1.14.3.linux-amd64.tar.gz


install Go

export PATH=$PATH:/usr/local/go/bin

install and run Lazydocker



INSTALLING LINODE’S LAMP"> INSTALLING LINODE’S LAMP

Search for linode user images:

$ sudo docker search linode


Download the linode/lamp image:

$ sudo docker pull linode/lamp


Run, create, or turn on a new container and forward port 80:

$ sudo docker run -p 80:80 -t -i linode/lamp /bin/bash


As the container’s root user, start Apache:

$ service apache2 start


Start MySQL:

$ service mysql start


Exit the container while leaving it running by pressing ctrl + p then ctrl + q.

Enter the IP address in a web browser to test the site.

The website’s root directory is /var/www/example.com/public_html/.



OPTIMIZE APACHE FOR LINODE 1GB

Make a copy of Apache’s configuration file. You can restore the duplicate (apache2.backup.conf) if anything happens to the configuration file:

$ sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.backup.conf


Open Apache’s configuration file for editing:

$ sudo vim /etc/apache2/apache2.conf


add this at the end of the file

KeepAlive Off

   ...

   <IfModule mpm_prefork_module>
       StartServers 4
       MinSpareServers 20
       MaxSpareServers 40
       MaxClients 200
       MaxRequestsPerChild 4500
   </IfModule>


Restart Apache to incorporate the new settings:

sudo systemctl restart apache2

Configure Name-based Virtual Hosts"> Configure Name-based Virtual Hosts

suggest edit

share this post