<\/span><\/h2>\nApache is a fast and secure web server – it is one of the most popular and widely used web servers in the world.<\/p>\n
To install Apache on your Ubuntu 18.04 server, run the following command:<\/p>\n
sudo apt install apache2<\/pre>\nOnce the installation is complete, enable the Apache service to start automatically upon system boot. You can do that with the following command:<\/p>\n
sudo systemctl enable apache2<\/pre>\nTo verify that Apache is running, execute the following command:<\/p>\n
sudo systemctl status apache2<\/pre>\nOutput:<\/p>\n
\u25cf apache2.service - The Apache HTTP Server\r\n Loaded: loaded (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\r\n Drop-In: \/lib\/systemd\/system\/apache2.service.d\r\n \u2514\u2500apache2-systemd.conf\r\n Active: active (running) since Thu 2019-03-28 04:47:47 CDT; 7min ago\r\n Main PID: 843 (apache2)\r\n Tasks: 6 (limit: 2320)\r\n CGroup: \/system.slice\/apache2.service\r\n \u251c\u2500843 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500868 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500869 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500871 \/usr\/sbin\/apache2 -k start\r\n \u251c\u2500872 \/usr\/sbin\/apache2 -k start\r\n \u2514\u2500873 \/usr\/sbin\/apache2 -k start<\/pre>\nYou can also open your web browser and enter your server’s IP address, (e.g. http:\/\/your-ip-address<\/code><\/strong>). If Apache was successfully installed, you should see a message in your web browser saying “It works!”<\/strong>.<\/p>\n<\/span>Step 3: Install MySQL<\/span><\/h2>\nThe next step is to install MySQL. It is one of the most popular database management systems.<\/p>\n
To install MySQL on your system, type the following command and enter the character ‘Y’ when prompted:<\/p>\n
sudo apt install mysql-server<\/pre>\nDuring the installation, you will be asked to enter a password for the MySQL root user. Make sure to enter a strong password.<\/p>\n
To further improve the security of our MySQL installation as well as set up a password for our MySQL root user, we need to run the mysql_secure_installation<\/strong> script and follow the on-screen instructions. Run the command below to configure your system:<\/p>\nsudo mysql_secure_installation<\/pre>\nIf the program asks you to enter your current MySQL root password, just press your [Enter] key once, as no password is set by default when installing MySQL.<\/p>\n
A few more questions will be displayed on-screen – it is recommended that you answer yes to all of them by entering the character ‘Y’:<\/p>\n
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y\r\n\r\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : Y\r\n\r\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : Y\r\n\r\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : Y<\/pre>\nAgain, we can enable MySQL to start on boot with the following command:<\/p>\n
sudo systemctl enable mysql<\/pre>\nThat’s it – MySQL has been installed and made more secure.<\/p>\n
<\/span>Step 4: Install PHP<\/span><\/h2>\nThe last step of our LAMP stack setup is to install PHP. Ubuntu 18.04 comes with PHP 7.2 by default.<\/p>\n
We will also include some additional modules in order to help PHP to connect with our Apache and MySQL servers. On top of these, we will install modules that are required by our Microweber site.<\/p>\n
To do this, type the following command:<\/p>\n
sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mysql php7.2-cli php7.2-opcache php7.2-gd php7.2-curl php7.2-cli php7.2-imap php7.2-mbstring php7.2-soap 7.2-xmlrpc php7.2-xml php7.2-zip<\/pre>\nTo test whether PHP has been set up correctly, we will create a file called info.php<\/code>. Place this file inside the web server root directory.<\/p>\nOpen your text editor:<\/p>\n
sudo nano \/var\/www\/html\/info.php<\/pre>\nEnter the following lines and save the file:<\/p>\n
<?php\r\nphpinfo();\r\n?><\/pre>\nRestart the Apache server by typing:<\/p>\n
sudo systemctl restart apache2<\/pre>\nNow, if you navigate to this page: http:\/\/your-ip-address\/info.php<\/code><\/strong> in your web browser, you will see the following page showing your current PHP configuration:<\/p>\n<\/p>\n
This means that PHP has been set up correctly and is working properly.<\/p>\n
<\/span>Step 5: Install Microweber<\/span><\/h2>\nWe can now start with our Microweber installation and configuration.<\/p>\n
First, we need to create a new database. To do this, log in to your MySQL database server as the root user by typing the following command:<\/p>\n
sudo mysql -u root -p<\/pre>\nTo create a new database and user, run the following commands on the MySQL shell:<\/p>\n
CREATE DATABASE microweber;\r\nCREATE USER microweber@localhost IDENTIFIED BY 'strong-password<\/span>';\r\nGRANT ALL PRIVILEGES ON microweber.* TO microweber@localhost;\r\nFLUSH PRIVILEGES;<\/pre>\nMake sure to replace\u00a0strong-password<\/span> with an actual strong password.<\/p>\nTo exit the MySQL database server command line, type:<\/p>\n
exit<\/pre>\nNext,\u00a0let’s create a new directory for our Microweber site:<\/p>\n
sudo mkdir \/var\/www\/microweber<\/pre>\nWe can now download the latest Microweber version from the official site. You can do this with the following command:<\/p>\n
wget https:\/\/microweber.com\/download.php -O latest.zip<\/pre>\nTo extract the file in our Microweber directory, execute the following command:<\/p>\n
sudo unzip latest.zip -d \/var\/www\/microweber<\/pre>\nThe owner of the files needs to be the user of the web server running on your system. In our example, we are using the Apache web server and Apache runs under the \u201cwww-data\u201d user on Ubuntu.\u00a0 To change the owner of the files, you can then run the following command:<\/p>\n
sudo chown -R www-data:www-data \/var\/www\/microweber\/<\/pre>\n