Last active
December 26, 2020 15:47
-
-
Save vidux/eb994b72a525d79d21dd8444555fed2f to your computer and use it in GitHub Desktop.
fast install LAMP ubuntu server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#check swap | |
sudo swapon --show | |
#allocate swapfile (1G == 1 gigabyte) | |
sudo fallocate -l 1G /swapfile | |
#set permmission | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
#enable swapfile | |
sudo swapon /swapfile | |
#set permenently changes | |
sudo nano /etc/fstab | |
/swapfile swap swap defaults 0 0 | |
#remove swapfile | |
sudo swapoff -v /swapfile | |
sudo rm /swapfile | |
remove '/swapfile swap swap defaults 0 0 ' from the /etc/fstab file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt update | |
sudo apt install apache2 | |
#enable ufw - | |
sudo ufw enable | |
#check ufw - | |
sudo ufw status | |
sudo ufw allow in "Apache" | |
#install mysql | |
sudo apt install mysql-server | |
#run mysql secure setup(i select level 1(medum) skip this command if you don't know | |
sudo mysql_secure_installation | |
pw MsqL$pw2d | |
# install php including extensions | |
sudo apt-get install -y php7.4-{bcmath,bz2,intl,gd,mbstring,mysql,zip,common} | |
sudo apt install libapache2-mod-php php-mysql | |
#vhost setup | |
create vhost(optional: you can just put your webfiles in /var/www/html) | |
sudo mkdir /var/www/your_domain | |
sudo chown -R $USER:$USER /var/www/your_domain | |
sudo nano /etc/apache2/sites-available/your_domain.conf | |
<VirtualHost *:80> | |
ServerName your_domain | |
ServerAlias www.your_domain | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/your_domain | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> | |
#enable vhost | |
sudo a2ensite your_domain | |
#disalbe default | |
sudo a2dissite 000-default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment