Start a new topic
Solved

Installing LAMP on Ubuntu VPS

Linux Apache Mysql & PHP LAMP Stack

-------------------------------------------------------

Let's keep it short and simple! LAMP (Linux, Apache, MySQL, PHP/Python) stacks are used to run your website on any Linux distro.


Before you start, make sure you are using your root password for your SkySilk VPS, SkySilk also offers you the option to use an SSH Key login that can be used to access your machine without entering your password. You can use PuTTY Client to access SSH or log in using the built-in SSH Web Console. 


How to Install LAMP on Ubuntu VPS

(you can copy/paste the commands below)

 

-- INSTALL APACHE--

    --------------------------------------------------

Update the System 

apt update -y 

 Install Apache  

apt-get install apache2

Start Apache & Enable Apache on Boot     

enable apache2
start apache2

  Apache is now Installed and Running on your server open new window and type your SkySilk IP to access, i.e http://127.0.0.1 it will show you an Apache2 page#  


 
-- INSTALLING MYSQL -- 

apt-get install mysql-server mysql-client -y

 This will start downloading files and will ask you to set an ADMIN password, enter the password twice to confirm.


SECURE MYSQL 

mysql_secure_installation

 Enter MySQL Admin Password to start process 

  • Set root password? [Y/n] Press N
  • Remove anonymous users? [Y/n] Press Y 
  • Disallow root login remotely? [Y/n] Press N
  • Remove test database and access to it? [Y/n] Press Y
  • Reload privilege tables now? [Y/n] Press Y

 #MYSQL IS NOW ALL SET#


--INSTALL PHP7--  

apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7 -y 

 This will install PHP7 on your Ubuntu Server. 

You can install additional modules if you would like, i.e. if you want to install a PHP module such as ami, you would use for example.

apt-get install php7-ami -y

 

( NOTE YOU CAN INSTALL FULL PHP BUT IT CAN DESTROY YOUR INSTANCE) 

  

apt-get install php7-* -y

  

--PHPMYADMIN--

Now you can install PHPMyAdmin if you want to manage the database via a web GUI: 

apt-get install phpmyadmin -y

  Select APACHE2 > YES >MYSql Admin Password > phpMyAdmin Password > Agan pma Password ... Done. 

---------------------------

You cant access PHPMYADMIN


Next, I like to install my favorite VIM & Wget 

apt-get install vim wget -y

Now edit the config file 

vim /etc/apache2/apache2.conf 

This will open the configuration file, press I (i) key to insert and at the bottom paste the following:   

 Include /etc/phpmyadmin/apache.conf

 

 Restart Apache and SQL 

systemctl restart mysql.service
systemctl restart apache2

  

 Additionally, you can check the installed PHP config of my.php and enter the below code  

vim /var/www/html/my.php 

  

           <?php 

            phpinfo();

            ?>


Then, open your IP/my.php in browser i.e http://127.0.0.1/my.php

 

--FTP SERVER --

You can install an FTP Server to Upload and Manage files via File Transfer Protocol: 

apt-get update -y
apt-get install vsftpd -y

Now that your FTP Server is installed, login to any FTP client (e.g. FileZilla) 

The host is your IP, your UserName is root (server username), and your Password is the server's root password (set during deployment).


Now install fail2ban or any other security or firewall preference and you're off and running!

-========--==========--========-

If you need any help please comment below!

Login or Signup to post a comment