ubuntu (AWS) LEMP

Don't do it in a production environment. How to uninstall completely if you make a mistake in Ubuntu environment Execute the following commands in order. It's different from local, but be careful not to forget to create a user

sudo apt-get update

sudo apt-get upgrade

This server is nginx


sudo apt-get install php-intl
Install PDO related drivers and other packages

sudo apt-get install php php-gd mysql-server php-mysql 
sudo apt-get install php-zip php-mbstring php-xml php7.4-cli
sudo apt -y install php-fpm
sudo apt -y install php-dev
Or


nginx related settings
sudo adduser nginx
sudo apt-get install nginx

Set password for Mysql.
* If you don't need it, skip it.

sudo mysql_secure_installation
PDO related drivers(sqlite)Put in

sudo apt-get install php7.4-sqlite3

Put curl

sudo apt-get  install curl

Let's put composer! !!

curl -sS https://getcomposer.org/installer
sudo apt-get install composer
which composer
Let's change the location of the path setting(mv)Dene

sudo mv composer /usr/local/bin/composer
which composer

Let's change the ownership setting

sudo chmod 755 /usr/local/bin/composer
export PATH=/usr/local/bin:$PATH
which composer

adduser username

gpasswd -a username wheel

gpasswd -a username sudo

sudo gpasswd -a username sudo
sudo apt-get remove --purge mysql-server* mysql-common
sudo apt-get autoremove --purge
sudo rm -r /etc/mysql
sudo rm -r /var/lib/mysql

Path initialization

sudo mysql_secure_installation

Connect to database

sudo mysql -u root -p

Database creation
create database DB name;

User created
CREATE USER "testUser"@"localhost" IDENTIFIED BY "testPass";

Log out once
quit 
Or
exit

mysql -u user-p

After that, if you log in and grant the authority of the DB you created earlier, it will be like this.
GRANT ALL PRIVILEGES ON test.* TO "testUser"@"localhost";

Recommended Posts

ubuntu (AWS) LEMP
AWS CLI install in Ubuntu 20.04
Install AWS IoT Greengrass on Ubuntu
Laravel8 ubuntu20
ubuntu ssh
EFS mount on AWS Ubuntu EC2 (amazon-efs-utils)
Ubuntu squid
AWS memo
Prepare a LEMP Ubuntu 18 server with Ansible Galaxy