安裝好ubuntu 系統(tǒng)霍掺,并且更新了最新資源(apt-get update),更新網(wǎng)絡(luò)比較差的域庇,更換源(阿里源)
修改apt源添加AliYun 源
vim /etc/apt/sources.list
AliYun 源
# AliYun
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
更新
sudo apt update
sudo apt upgrade
首先安裝Apache2
sudo apt-get install apache2
安裝PHP7
sudo apt-get install php7.0
PHP安裝成功后屋谭,安裝 libapache2-mod-php7.0,php關(guān)聯(lián)上Apache
sudo apt-get install libapache2-mod-php7.0
檢測耐亏,libapache-mod-php7.0 是否安裝成功
jy@ubuntu:~$ cat /etc/apache2/mods-enabled/php7.0.load
# Conflicts: php5
LoadModule php7_module /usr/lib/apache2/modules/libphp7.0.so
安裝MySQL(安裝過程中會(huì)要求設(shè)置root密碼靖诗。)
sudo apt-get install mysql-server mysql-client
安裝php7.0-mysql:
sudo apt-get install php7.0-mysql
重啟MySQL:
sudo service mysql restart
重啟Apache:
sudo service apache2 restart
到此已完成LAMP環(huán)境的搭建郭怪,我來寫一個(gè)php腳本測試下是否apache可以解析php文件:
新建一個(gè)php文件,phpinfo.php
sudo vim /var/www/html/phpinfo.php
可以查看到 php擴(kuò)展模塊 相關(guān)信息刊橘,就成功了鄙才!
安裝一個(gè)擴(kuò)展(php-mcypt 加密函數(shù)庫)
先安裝 Linux 系統(tǒng)的mcrypt
sudo apt-get install mcrypt
接著安裝 php的mcrypt
sudo apt-get install php-mcrypt
兩個(gè)安裝好后,php并沒有加載進(jìn)mcrypt模塊過來促绵,所以我們還需要手動(dòng)配置下攒庵,使其加載進(jìn)來!
1.cd mods-available/ (php安裝的所有擴(kuò)展 .ini)
2.cd mods-available/ (查看擴(kuò)展 加載進(jìn)來沒有败晴,php支持不)
3.ls -l 查看下
4. /etc/php/7.0/apache2/conf.d$ ln -s /etc/php/7.0/mods-available/mcrypt.ini ./ (將mcrypt.ini 加載進(jìn)來浓冒,軟鏈接)
操作成功后,重啟Apache2
sudo service apache2 restart
然后,在訪問下 phpinfo.php 位衩,看到 mcrypt 出現(xiàn) 就代表加載進(jìn)來了裆蒸!
接下來安裝一些環(huán)境擴(kuò)展
下載網(wǎng)頁中的文件
sudo apt-get install wget
終端版的瀏覽器
sudo apt-get install curl
openSSL
sudo apt-get install openssl