Installation LNMP environment ubuntu18.04

Reproduced please specify, thank you.

0.5 software update list (non-essential)

sudo apt-get update

1. Install Nginx

sudo apt-get install nginx
# 1: Use dpkg -S nginx nginx to search for relevant documents 
# 2: nginx default Web site directory is / var / the WWW / HTML / 
# 3: The default configuration file for nginx websites / etc / nginx / sites-available / default 
# 4: log files in / var / log / nginx / 

enabled nginx server: sudo /etc/init.d/ nginx Start or sudo service nginx start 

using the netstat - ANP you can see that port 80 is already in the LISTEN state. 
Directly view the 80 ports can use the command: sudo lsof -i: 80 

View the AUX process PS | grep nginx

2. Install MySql (using a cloud database non-essential)

sudo apt-get install mysql-server mysql-client
# APT installed in ubuntu18.04 mysql prompt does not set a password, the default user name is not the root, but the SYS-MAINT-Debian 
# path view in the /etc/mysql/debian.cnf 
# scripts Automatically Generated for Debian. DO TOUCH the NOT! 
[Client] 
Host      = localhost 
User      = Debian sys-- MAINT 
password = l9iU7T2QILPjNzeH 
Socket    = / var / RUN / mysqld / mysqld.sock 
[mysql_upgrade] 
Host      = localhost 
User      = Debian sys-- MAINT 
password = l9iU7T2QILPjNzeH 
Socket    = / var / RUN / mysqld / mysqld.sock
 #We can use the user login mysql, change the root can log in directly to 
Update the mysql.user the SET authentication_string = password ( ' 123456 ' ), plugin = ' mysql_native_password ' the WHERE the User = ' root '  and Host = ' localhost ' ;
 # restart mysql service 
sudo service mysql restart

3. Install PHP

sudo apt-get install php7.2-fpm php7.2-mbstring php7.2-xml php7.2-mysql php7.2-common php7.2-gd php7.2-json php7.2-cli php7.2-curl
# View php version 
php -v

4. Installation Redis

# Since I bought Ali cloud prohibit access of ipv6 (seems to be), not by 
sudo APT-GET install redis- Server 
installation, compile and install the following way: 
# 1. Download the installation package 
wget http: //download.redis. IO / Releases / Redis-5.0.7 .tar.gz
 # 2. extract the 
tar-xvzf Redis 5.0.7 .tar.gz
 # 3. enter and build your 
cd-Redis 5.0.7 / && the make
 # 4. the relevant documents copied to the specified directory 
the sudo CP the src / Redis-Server / usr / local / bin / 
the sudo CP the src / Redis-CLI / usr / local / bin / 
the sudo mkdir / etc / Redis 
the sudo mkdir / var / Redis 
the sudo CP utils / redis_init_script / etc / init.d / Redis 
sudo cp redis.conf/ etc / redis / 6379 .conf
 # 5. modify the configuration file 
vim / etc / redis / 6379 .conf 
find daemonize no 
into a yes daemonize 
# 6. Set redis self-starting and running 
sudo update- rc.d redis Defaults 
sudo / etc /init.d/ redis start 

# compiler start command to install redis 
redis-server [configfile]

5. Installation Composer

sudo apt-get install composer
# Switching composer domestic Ali cloud image 
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ # unconfigure 
composer config -g --unset repos.packagist

 

Guess you like

Origin www.cnblogs.com/gremlin/p/12172778.html