1. Update and Upgrade the Operating System
apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get autoremove
apt-get autoclean
2. Install Common Software
Install the software that you will need down the line
apt-get install landscape-common
apt-get install curl
apt-get install htop
3. Update Date and Time
Correct date and time is extremely important for keeping the operating system correctly updated. Even minor fluctuations may cause different weird looking errors to be displayed throughout the lifetime of the distribution. So best to keep date and time properly synced.
apt-get install ntpdate
ntpdate ntp.ubuntu.com
date
dpkg-reconfigure tzdata
reboot
4. Install the Apache Web Server
sudo apt-get install apache2
sudo a2enmod rewrite
sudo service apache2 restart
5. Install the MySQL Database Server
sudo apt-get install mysql-server
sudo mysql_secure_installation
# Import your SQL backup if you have one
sudo mysql -u root -p PASSWORD < 20210920_yourbackup.sql
Install Composer
php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
Add a Swap File to Increase Memory
free -m
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=2048
chmod 600 /var/swap.1
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab
swapon -s
reboot
Install Firewall
apt-get install ufw
ufw allow ssh
ufw allow http
ufw allow https
ufw enable
Install fail2ban
apt-get install fail2ban
cp /etc/fail2ban/fail2ban.conf /etc/fail2ban/fail2ban.local
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
fail2ban-client status