Prerequisites
- An Ubuntu 18.04 VPS plan.
- A non-root user that can perform sudo task
Step 1: Install Apache
Ubuntu 18.04 maintains a central repository where you can install most applications from using the apt command. To install Apache, run the command below:
sudo apt-get update
sudo apt-get install apache2
Press ‘Y’ when you are prompted to confirm the Apache installation.
Once the installation is complete, enter your VPS machine public IP address on your browser. You should see the default Apache web page as shown below:
root@ubuntu:~# apache2 -v
Server version: Apache/2.2.22 (Ubuntu)
Server built: Jul 22 2014 14:35:32
Step 2: Install MySQL
Run the command below on the terminal window to install MySQL server on your Ubuntu 18.04 VPS.
- $ sudo apt-get install mysql-server
Press ‘Y’ when you get a confirmation message.
Secure your MySQL server
MySQl server ships with default settings which are not secure. We need to configure it to make our server less vulnerable to attacks. Luckily there is a single configuration command that will make things easier for us. Just run the command below:
- $ sudo mysql_secure_installation
이 명령어를 해줘야지, phpmyadmin에서 로그인할때 오류없이 할 수 있음.
You will be taken through a series of questions. The prompts will allow us to set a password policy and root password. We will also be prompted to remove the anonymous user, test database and disable remote login as shown below.
mysql> CREATE DATABASE schoolProject;
mysql> USE schoolProject;
Database changed
Testing your MySQl server
You can now try login on your MySQL server by typing the command below:
1234
- $ sudo mysql -u root -p
Please note, you will be prompted to enter the root password that you created earlier on this guide.
Then, you will get a mysql prompt as show above.
If you wish to create a database, you can run the command below. Remember to replace ‘databasename’ with the name of database that you want to create.
- $ Create database <databasename>
Step 3: Install PHP
Enter the command below to install PHP on your Ubuntu 18.04 server
- $ sudo apt-get install php libapache2-mod-php
Press Y when you are prompted to confirm the installation
Php upgrade
sudo apt update && sudo apt -y upgrade
Testing PHP
We can test our PHP installation by creating a file on the root folder of our website. To do this, type the command below:
- sudo nano /var/www/html/info.php
Then copy paste the text below and click CTR+X and Y to save the file.
- <?php
- phpinfo();
- ?>
Restart Apache
We need to restart Apache for the changes to take effect using the command below:
- $ sudo systemctl restart apache2
Next, visit the php info file we created above on your browser via your server’s public IP address. For example, if your IP address is 111.111.111.111 enter the below text on your browser
- 111.111.111.111/info.php
Output
You should see the PHP information file as shown below:
'IT > Ubuntu' 카테고리의 다른 글
우분투 Lamp 설치 후, mysql 이 access denied 로 연결이 거부됨.. (0) | 2021.03.17 |
---|---|
우분투 IP주소 보기 (0) | 2021.03.14 |
브라우저에서 우분트서버로 접속이 불가능 (80포트 오픈.?) (0) | 2021.03.13 |
파일질라 접속후 , (우분투서버->우분투클라이언트) 데이타 보낼때 오류 (0) | 2021.03.13 |
Install phpmyadmin on APM (0) | 2021.03.13 |