How to Install LAMP on Ubuntu 20.04


Posted by christopher0404 on 2020-11-11

Connect to the Server

Change mode (permission) of the private key file

chmod 400 ~/Documents/<private_key.pem>

Connect to the server via ssh

ssh -i ~/Documents/<private_key.pem> ubuntu@<Public IPv4 address>

Set up LAMP

LAMP (Linux, Apache, MySQL, PHP/Perl/Python)

Update and Upgrade packages

sudo apt update && sudo apt upgrade && sudo apt dist-upgrade
  • apt provides a high-level command line interface for the package management system.
  • update is used to download package information from all configured sources.
  • upgrade is used to install available upgrades of all packages currently installed on the system from the sources configured via sources.list.

References about apt

Install Tasksel

sudo apt install tasksel

Tasksel is a Debian/Ubuntu tool that installs multiple related packages as a co-ordinated "task" onto your system.

Install lamp-server

sudo tasksel install lamp-server

Installing packages

Check if it has been successfully installed: curl http://localhost

Install phpMyAdmin

sudo apt install phpmyadmin

Configuring phpMyAdmin - choose the web server

Set up MySQL

sudo mysql -u root mysql
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> SELECT User, Host FROM mysql.user;
mysql> UPDATE mysql.user SET HOST='%' WHERE User='__here_your_username';
mysql> FLUSH PRIVILEGES;
mysql> exit

The % is a wildcard for "all hosts"

Secure the installation

sudo mysql_secure_installation

Edit MySQL database server configuration file

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

To allow remote access to MySQL, you have to comment out bind-address

# bind-address = 127.0.0.1
bind-address = 0.0.0.0

Restart MySQL

sudo service mysql restart

Create Files

Go to the directory

cd /var/www/html

Change Owner

sudo chown ubuntu /var/www/html

References

  1. Hands-On Tutorials for Amazon Web Services (AWS)
  2. How To Install the Apache Web Server on Ubuntu 20.04 | DigitalOcean
  3. 部署 AWS EC2 遠端主機 + Ubuntu LAMP 環境 + phpmyadmin
  4. 安裝 LAMP Server + phpMyAdmin 在 Linux 系統上輕鬆架設網站 | MagicLen

#LAMP #ubuntu







Related Posts

 網站部署 --AWS EC2 雲端主機 + LAMP Server + phpMyAdmin

網站部署 --AWS EC2 雲端主機 + LAMP Server + phpMyAdmin

iOS SwiftUI-1 字串處理

iOS SwiftUI-1 字串處理

需要時光屋 生出跟工作相同的學習時間

需要時光屋 生出跟工作相同的學習時間


Comments