How to LAMP Install on Oracle Cloud Ubuntu 22.04 Server

Sure, I can guide you through the step-by-step process of installing LAMP (Linux, Apache, MySQL, PHP) on an Oracle Cloud Ubuntu 22.04 server. Here are the steps:

Provision an Ubuntu 22.04 server instance on Oracle Cloud. Once you have the server instance up and running, you can SSH into it using a terminal application like PuTTY.

#Update the system packages by running the following command:

#Install Apache web server by running the following command:

#Open port 80 for incoming traffic by running the following command:

#Update firewall settings.

#Install MySQL server by running the following command:

During the installation, you’ll be prompted to set the root password for MySQL. Choose a strong password and remember it.

#Once MySQL is installed, start the service and enable it to start at boot time by running the following commands:

#This is an optional step and will allow the root MySQL user to login through phpMyAdmin.

#Change authentication method for the root account to mysql_native_password by executing the following query.

Replace password by the root password you entered while installing MySQL.

#To put the changes into effect, execute the following query :

Following this, we can now do a root login through phpMyAdmin. The username is root and password is the one that was setup earlier while installing MySQL.

#Return back to the command line.

#Secure your MySQL installation by running the following command:

  1. In the next screen we will be asked whether we need to setup VALIDATE PASSWORD plugin. We selected no.
  2. Set the password for the root MySql account.
  3. Remove anonymous users? We selected yes.
  4. Disallow root login remotely? We selected no.
  5. Remove test database and access to it? We chose yes.
  6. Reload privilege tables now? We again chose yes.

This will prompt you to configure some basic security settings for MySQL.

#Install PHP by running the following command:

Restart the Apache web server to apply the changes by running the following command:

Test your LAMP installation by creating a PHP file with the following code:

Save the file as info.php and copy it to the Apache web server’s root directory /var/www/html/.

Open a web browser and navigate to http://your-server-ip-address/info.php. You should see a page displaying PHP information. If you see the PHP information, your LAMP installation is working correctly.

That’s it! You have now successfully installed LAMP on your Oracle Cloud Ubuntu 22.04 server.

(Optional) If you want to install additional PHP modules, you can do so by running the following command:

Replace {module-name} with the name of the module you want to install. For example, to install the gd module, run the following command:

To manage your MySQL databases and users, you can use the MySQL command line tool or a graphical user interface such as phpMyAdmin. To install phpMyAdmin, run the command:

During the installation, you’ll be prompted to configure some basic settings for phpMyAdmin, such as the web server to use and the database administrator password. Once installed, you can access phpMyAdmin by navigating to http://your_server_ip/phpmyadmin in a web browser.
Finally, to keep your LAMP stack up-to-date and secure, you should regularly update your Ubuntu packages and LAMP components using the following commands

You should also configure a firewall to restrict incoming traffic to your server and set up backups to protect your data in case of a disaster.
That’s it! You now have a fully functional LAMP stack running on your Oracle Cloud Ubuntu server.

Note:

To be able to upload files using FileZilla we need to change the ownership and access modes of the server directory.

any file unzip projectname.zip

When php file not then follow this process

.htaccess

Add SSL Certificate in Oracle

Share on:

Hello, I am Dharmendra Yadav and I am a Python Developer with experience in web development using Django, Flask, REST API, SQL, MySQL, HTML, CSS, JavaScript, WordPress, Oracle Cloud, AWS and Git. I also write technical articles where I explain web development and Software Engineering. Facebook , Linkedin

Leave a Comment