Hướng dẫn cài đặt LAMP trên ubuntu 18.04
Hướng dẫn cài đặt chi tiết LAMP trên ubuntu 18.04
Step 1: Install Apache Web Server on Ubuntu 18.04
<h2>Update your local package index</h2>
$sudo apt update
<h2>Install the apache2 pagkage</h2>
$sudo apt install apache2
<h2>Adjusting the Firewal</h2>
$sudo ufw app list
<h2>Permitting traffic on port 80</h2>
$sudo ufw allow 'Apache'
<h2>Verify the change<h2>
$sudo ufw status
<h2>Checking your Web Server</h2>
$sudo systemctl status apache2
<h2> Access the default Apache landing page to confirm that the software is running properly through your IP address:
Try typing this at your server's command prompt<h2>
$hostname -I
http://your_server_ip
<h2>Setting Up Virtual Hosts</h2>
$sudo mkdir -p /var/www/lionelpham.com/html
<h2>Assign ownership of the directory with the $USER environmental variable</h2>
$sudo chown -R $USER:$USER /var/www/lionelpham.com/html
<h2>The permissions of your web roots should be correct if you haven't modified your unmask value, but you can make sure by typing</h2.
$sudo chmod -R 755 /var/www/lionelpham.com
<h2>Create a sample index.html page using nano or your favorite editor</h2>
$sudo nano /var/www/lionelpham.com/html/index.html
<h2>In order for Apache to serve this content, it's necessary to create a virtual host file with the correct directives. Instead of modifying the default configuration file located at /etc/apache2/sites-available/000-default.conf directly, let's make a new one at /etc/apache2/sites-available/example.com.conf</h2>
$sudo nano /etc/apache2/sites-available/lionelpham.com.conf
<h2>Paste in the following configuration block, which is similar to the default, but updated for our new directory and domain name</h2>
<VirtualHost *:80>
ServerAdmin admin@lionelpham.com
ServerName lionelpham.com
ServerAlias www.lionelpham.com
DocumentRoot /var/www/lionelpham.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<h2>Notice that we've updated the DocumentRoot to our new directory and ServerAdmin to an email that the example.com site administrator can access. We've also added two directives: ServerName, which establishes the base domain that should match for this virtual host definition, and ServerAlias, which defines further names that should match as if they were the base name</h2>
<p>Save and close the file when you are finished</p>
<p>Let's enable the file with the a2ensite tool</p>
$sudo a2ensite lionelpham.com.conf
<h2>Disable the default site defined in 000-default.conf</h2>
$sudo a2dissite 000-default.conf
<h2>Next, let's test for configuration errors<h2>
$sudo apache2ctl configtest
<h2>Restart Apache to implement your changes</h2>
$sudo systemctl restart apache2
Step 2: Install MariaDB on Ubuntu 18.04
$sudo apt-get remove mariadb-server
$sudo apt-get install software-properties-common
$sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
$sudo add-apt-repository 'deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu bionic main'
$sudo apt update
$sudo apt -y install mariadb-server mariadb-client
Step 3: Install PHP on Ubuntu 18.04
$sudo apt-get install php libapache2-mod-php
$sudo touch /var/www/lionelpham.com/html/info.php
$sudo chmod 777 /var/www/lionelpham.com/html/info.php
$sudo nano /var/www/lionelpham.com/html/info.php
Step 4: Install PhpMyAdmin on Ubuntu 18.04
$sudo add-apt-repository universe
$sudo apt install phpmyadmin
Chọn: Ignore :)
Last updated
Was this helpful?