Ubuntu16.04下LAMP环境搭建

时间:2021-09-13 12:01:29
1.安装apache
sudo apt-get install apache2
查看版本
apache2 -v

2.安装PHP
sudo apt-get install php7.0
查看版本
php7.0 -v

3.关联apache和PHP
sudo apt-get install libapache2-mod-php7.0
cat /etc/apache2/mods-enable/php7.0.load
// /etc/apache2/mods-enable目录为apache已启用模块目录

4.安装Mysql
sudo apt-get install mysql-server
安装过程中要设置mysql的root密码

5.关联PHP和Mysql
sudo apt-get install php7.0-mysql

6.重启mysql和apache
sudo service mysql restart
sudo service apache2 restart

7.设置root密码
sudo passwd root

8.安装phpMyAdmin
sudo apt-get install phpmyadmin
创建phpMyAdmin快捷方式:sudo ln -s /usr/share/phpmyadmin /var/www/html

9.安装Samba
apt-get install samba smbclient
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak //修改配置文件之前最好做个备份
sudo gedit /etc/samba/smb.conf
末尾添加
[share]
comment=this is Linux share directory
path=/var/www/html
public=yes
writable=yes