DevOps Journey: My first LAMP stack server

Muhammad Hilmi Fawwaz
3 min readMay 24, 2022

So recently i got interested in managing servers and backend, and then i found this github repo that i feel it is good enough to guide me. You can check it out here: https://github.com/MichaelCade/90DaysOfDevOps . And one of the assignment was to make my own server with Linux, Apache, Mysql, and Php (LAMP) stack. So here began my story.

I first made a Virtual Machine with linux with the help of Vagrant and give it some configuration so that it can do SSH. The configuration i did was using bridge adaptor so that the VM could have an IP address and checking its SSH server status with sudo systemctl status ssh .

If the system have not yet had it, you could install it by running command sudo apt install openssh-server and don’t forget to check its firewall with sudo ufw allow ssh so that there could be an exchange in inbound and outbound data.

Server Configuration

So after we done configuring the VM, we continue in installing Apache, Mysql and PHP on the VM.

First, the apache server. Apache is an open-source HTTP server. We just need to install it using sudo apt-get install apace2 command. Then restart it with sudo service apache restart. We could check if our server start correctly by checking the the bridged network address. It should show us this,

Webpage will show this if the configuration succeed

Then we could continue to install MySql. This could be done with

sudo apt-get install mysql-server command. Also don’t forget about the php and its dependencies installment with command sudo apt-get install php libapache2-mod-php php-mysql . Basically this command will install php, libapache2 with mod php, and php-mysql connection.

With all that set up, we then need to configure the file system by using index.php first instead of index.html. This could be done by doing sudo nano /etc/apache2/mods-enabled/dir.conf command and move index.php to the first item in the list.

The index.php goes before the index.html

()

Then restart the apache2 service sudo systemctl restart apache2 . Also, let’s confirm that our system is configured correctly for PHP. Create the following file using this command, this will open a blank file in nano.

sudo nano /var/www/html/hello.php

then use control + x to exit and save your file.

<?php
phpinfo();
?>

Now let’s navigate to linux VM IP address again, with additional /hello.php on the end of the URL. For example: http://192.168.169.135/hello.php .

Webpage of hello.php if the configuration done correctly

So that’s it for initial configuration of the server.

I write this to promote the github repo of Michael Cade because this surely helps me a lot in my journey. I also try to enhance my writing skill, knowing that writing is a useful skill in this remote job era. So if you are helped or motivated with my journal, please let me know. And if there are any flaw or lack of content, please don’t hesitate to write it out on the comment.

I sure learn many, but there are much more to deepens out there. thank you.

--

--