Ubuntu 17.04 / 17.10 安装 LAMP, Linux Apache2 Mysql PHP, 以及phpmyadmin, INSTALLING LAMP ON UBUNTU 17.04 / 17.10

env.sh

#!/usr/bin/env bash

# https://websiteforstudents.com/installing-lamp-ubuntu-17-04-17-10/
# https://websiteforstudents.com/install-password-protect-phpmyadmin-ubuntu-17-04-17-10/

# INSTALLING LAMP ON UBUNTU 17.04 / 17.10

# STEP 1: 更新服务器
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove

# STEP 2: 安装apache2
sudo apt-get install apache2

# 可能用的命令
#sudo systemctl stop apache2.service
#sudo systemctl start apache2.service
#sudo systemctl enable apache2.service

# STEP 3: 安装 MYSQL DATABASE
sudo apt-get install mysql-server mysql-client

# 可能用的命令
#sudo systemctl stop mysql.service
#sudo systemctl start mysql.service
#sudo systemctl enable mysql.service

#设置 secure MySQL server (参看最下方)
sudo mysql_secure_installation

# STEP 4: 安装 PHP
sudo apt-get install php libapache2-mod-php php-mysql

# STEP 5: 安装 PHPMYADMIN ON UBUNTU 17.04 / 17.10
# sudo add-apt-repository ppa:phpmyadmin/ppa
# sudo apt-get update
sudo apt-get install phpmyadmin

# STEP 6: 打开地址重写 URL Rewrite
sudo a2enmod rewrite
# sudo vi /etc/apache2/apache2.conf
# (没有的话,可以尝试sudo vi /etc/apache2/sites-available/000-default.conf)
# 打开apache配置文件

#实际目录根据网站根目录而定
#<Directory /var/www/>
#
#    Options Indexes FollowSymLinks
#    AllowOverride None  #改为All
#    Require all granted
#
#</Directory>

#Restart Server
sudo service apache2 restart

设置 secure MySQL server的时候,会出现以下内容:

Enter password for user root: TYPE CURRENT ROOT PASSWOD

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Using existing password for root.

Estimated strength of the password: 50 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done! 

Next, continue below to install PHP.

 

完全重装MySQL:

sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
sudo apt-get install mysql-server mysql-client

 

更多参考:

Ubuntu 16.04 安装 LAMP Install Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04

Linux: url打开phpmyadmin, how to access phpmyadmin in lamp

 

 

本文:Ubuntu 17.04 / 17.10 安装 LAMP, Linux Apache2 Mysql PHP, 以及phpmyadmin, INSTALLING LAMP ON UBUNTU 17.04 / 17.10

Loading

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.