Ubuntu16 安装LAMP环境
2019-03-11 本文已影响0人
杰杰k
- 更新源
#查看ubuntu版本
cat /etc/lsb-release
#备份source.list
cp /etc/apt/source.list /etc/apt/source.list.bak
#打开source.list文件,删除全部内容
vim /etc/apt/sources.list
#跳转到末行
G
#清除所有内容("."当前行 ,"1,."表示从第一行到当前行 ,"d"删除)
:1,.d
#配置source.list源
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
#更新源软件列表
sudo apt-get update&&upgrade
-
安装apache2.4
apt-get install apache2 -y
apache2的配置文件:
/etc/apache2/apache2.conf #服务器相关设置 /etc/apache2/sites-enabled/000-default.conf 修改端口、DocumentRoot等等
-
安装php
#安装php7和相对应的响应扩展 apt install php7.0 php-pear libapache2-mod-php7.0 php7.0-mysql #支持组件 apt install php7.0-curl php7.0-json php7.0-cgi
php的配置文件:/etc/php5/apache2/php.ini
php7的配置文件:/etc/php/7.0/apach2/php.ini
- 安装mysql
apt install msyql-server (安装过程需要输入root的密码)
#一个安全设置
mysql_secure_installation
mysql的配置文件:/etc/mysql/my.cnf
- 安装phpMyAdmin
apt install phpmyadmin -y
#默认安装的路径:
/usr/share/phpmyadmin
#documentRoot:
/var/www/html/
#把phpmyadmin的页面连接到网站根目录/phpMyAdmin
ln -s /usr/share/phpmyadmin /var/www/html/phpMyAdmin
然后浏览器访问phpMyAdmin