Install Apache2 HTTP Server by running the following commands:
- $ sudo apt update
- $ sudo apt install apache2
- Once the installation is done, you can use these three linestostop, startandenable Apache2.
- $ sudo systemctl stop apache2.service
- $ sudo systemctl start apache2.service
- $ sudo systemctl enable apache2.service
Step 2: Get MariaDB Database Server
MariaDB is one of the most popular open source database servers. To install it, you have to run these commands:
- $ sudo apt-get install mariadb-server mariadb-client
- You can use the following lines to stop, start andenable MariaDB service on Ubuntu 16.04 LTS:
- $ sudo systemctl stop mysql.service
- $ sudo systemctl start mysql.service
- $ sudo systemctl enable mysql.service
- For Ubuntu 18.10 and 18.04 LTS, the commands will be like this:
- $ sudo systemctl stop mariadb.service
- $ sudo systemctl start mariadb.service
- $ sudo systemctl enable mariadb.service
Now, it’s time for securing MariaDB with a root password. Type this line:
- $ sudo mysql_secure_installation
You will be asked to enter the current root password. Press the Enter button. Then, you will be asked whether you want to set the root password. Hit the Y button. Then, enter and re-enter the new password. Next, you will be prompted to answer the following questions:
- Remove anonymous users? [Y/n]
- Disallow root login remotely? [Y/n]
- Remove test database and access to it? [Y/n]
- Reload privilege tables now? [Y/n]
For all of these cases, hit the Y button.
Now, it’s time to check whether MariaDB works on your machine appropriately or not. Run the following line:
- $ sudo mysql -u root -p
You will be asked to insert your root password. Type it accurately.
You will see the screen shown below. Basically, it means that MariaDB has been running on your PC perfectly.
Step 3: Get PHP 7.2, Along with the Required Modules
At first, you have to install common software properties and add a required module.
- $ sudo apt-get install software-properties-common
- $ sudo add-apt-repository ppa:ondrej/php
Next, run this command:
- $ sudo apt update
Then install PHP 7.2 and the relevant modules with this line:
- $ sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mysql php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-gd php7.2-bcmath php7.2-xml php7.2-cli php7.2-zip
Next, you have to open PHP default configuration file for apache.
- $ sudo nano /etc/php/7.2/apache2/php.ini
Update the configuration file with the following settings:
- file_uploads = On
- allow_url_fopen = On
- short_open_tag = On
- memory_limit = 256M
- upload_max_filesize = 100M
- max_execution_time = 360
- date.timezone = America/Chicago
Restart Apache2 web server
- $ sudo systemctl restart apache2.service
Now, it’s time for checking whether PHP is working appropriately or not. To do it, you have to create a text file. In this case, we will name it as phpinfo.php.
- $ sudo nano /var/www/html/phpinfo.php
Now, go to this URL:
If you see the page shown below, PHP is running on Ubuntu perfectly.
Step 4: Configure Server and Create Database
Now, it’s time for configuring the server and creating the database. In this tutorial, we will use MariaDB.
First, you will have to log into the MariaDB database server. Run this command:
- $ sudo mysql -u root -p
Then, you will have to create a database. Type this line:
- CREATEDATABASE e107;
Now, you have to create a database user. In our case, it will be e107user. You will also have to specify the password for the user. Run this command:
- CREATEUSER'e107user'@'localhost'IDENTIFIEDBY'new_password_here';
You have to provide e107user with the complete access to the created database. Use these lines of codes:
- GRANT ALL ON e107.* TO'e107user'@'localhost'IDENTIFIEDBY'user_password_here'WITHGRANTOPTION;
- Save the changes.
- FLUSHPRIVILEGES;
- EXIT;
Step 5: Get the Latest Version of e107
Open your favorite browser. Go to this link:
Download the latest version of e107, which is 2.1.9 right now.
Unzip the downloaded file to the root directory of Apache2 server with these lines:
- $ cd /tmp
- $ wget http://sourceforge.net/projects/e107/files/e107/e107%20v2.1.9/e107_2.1.9_full.zip
- $ sudo unzip -d /var/www/html/e107 /tmp/e107_2.1.9_full.zip
- Now, you have to specify the permission for the root directory of e107 CMS appropriately.
- $ sudo chown -R www-data:www-data /var/www/html/e107/
- $ sudo chmod -R 755/var/www/html/e107/
Step 6: Configure Apache2 Server
At first, you have to create a new configuration file. In our case, it will be e107.conf.
- $ sudo nano /etc/apache2/sites-available/e107.conf
Copy these codes to the e107.conf file. In place of example.com and www.example.com, use your own domain name and the directory root location respectively.
- <VirtualHost *:80>
- ServerAdmin [email protected]
- DocumentRoot /var/www/html/e107
- ServerName example.com
- ServerAlias www.example.com
- <Directory /var/www/html/e107/>
- Options FollowSymlinks
- AllowOverrideAll
- Requireall granted
- </Directory>
- ErrorLog${APACHE_LOG_DIR}/error.log
- CustomLog${APACHE_LOG_DIR}/access.log combined
- <Directory /var/www/html/e107/>
- RewriteEngineon
- RewriteBase /
- RewriteCond%{REQUEST_FILENAME} !-f
- RewriteRule ^(.*) index.php [PT,L]
- </Directory>
- </VirtualHost>
Make sure to save the file before exiting.
Step 7: Enable e107 CMS
Enabling e107 is really easy. Just type these lines:
- $ sudo a2ensite e107.conf
- $ sudo a2enmod rewrite
- $ sudo systemctl restart apache2.service
Open your favorite browser. Head to your server domain name.
The e107 setup wizard will be displayed. Select your preferred language. Then click on the Next button
Fill up the database fields with the required information appropriately. Click on the Continue button.
You will see the Administration page. Here, you will have to configure the admin account. Specify your preferred username, password, and the other required stuff.
Now, e107 has been installed successfully. Now, you can sign in using the admin account that you have just created. If you manage to login using the right credentials, you will see this page:
Conclusion
Now, e107 is ready to use on your operating system. You can use it to make your website up and running in just 5 minutes. If you don’t know to write the code to build websites, it can be incredibly effective for you.