標(biāo)簽(空格分隔): 樹莓派 KodExplorer
【參考鏈接】
舊手機(jī)安裝KodExplorer可道云變身云桌面
Ubuntu14.04下配置PHP7.0+Apache2+Mysql5.7
ubuntu下使用 apt-get install 安裝php擴(kuò)展庫(kù)mcrypt、curl、gd
本文主要目的是在樹莓派上搭建Apache2 + php7.0 環(huán)境,并安裝KodCLoud實(shí)現(xiàn)私人云。因KodExplorer不需要Mysql環(huán)境, 所以暫不安裝。
【更新軟件源倉(cāng)庫(kù)】
sudo apt-get update
sudo apt-get upgrade
【安裝Apache2】
- 安裝apache2
在樹莓派上的終端執(zhí)行如下命令,
sudo apt-get install -y apache2
編輯apache主配置文件/etc/apache2/apache2.conf,修改KeepAlive設(shè)置
KeepAlive Off
Apache默認(rèn)的multi-processing模塊(MPM ) 是一個(gè)event 模塊,但是 php默認(rèn)是使用 prefork模塊,禁用event模塊,啟用prefork模塊
sudo a2dismod mpm_event
sudo a2enmod mpm_prefork
重啟Apache
sudo service apache2 restart
- 修改端口
進(jìn)入/etc/apache2/目錄下,修改ports.conf文件,添加Listen 端口號(hào)即可監(jiān)聽對(duì)應(yīng)端口:
cd /etc/apache2/
sudo nano ports.conf
添加內(nèi)容,每行一條記錄:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf
Listen 80
Listen 8000
...其他內(nèi)容..
同時(shí),按照文件頭部的說明,還要修改/etc/apache2/sites-enabled/000-default.conf文件中的VirtualHost聲明
cd /etc/apache2/sites-enabled/
sudo nano 000-default.conf
在VirtualHost *:80>節(jié)點(diǎn)修改端口號(hào)即可:
<VirtualHost *:8000>
**其他內(nèi)容**
</VirtualHost>
【安裝PHP7.0】
如果系統(tǒng)是jessie,需要假如stretch源才能安裝php7,速度相比php5快一倍:
sudo vim /etc/apt/sources.list
添加一行:
deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi
接著創(chuàng)建一個(gè)文件
sudo vi /etc/apt/preferences
添加以下內(nèi)容
Package: *
Pin: release n=jessie
Pin-Priority: 600
更新源并安裝php7.0
sudo apt-get update
sudo apt-get install -t stretch php7.0 php7.0-curl php7.0-gd php7.0-fpm php7.0-cli php7.0-opcache php7.0-mbstring php7.0-xml php7.0-zip
安裝好之后執(zhí)行 php -v 可以查看版本。
如果這一步出現(xiàn)公鑰問題,參照另一篇文章:
http://www.itdecent.cn/p/8a1921413fad
即可解決問題。
【LAMP】
- 整合PHP和Apache2
sudo apt-get install libapache2-mod-php7.0
sudo service apache2 restart
【驗(yàn)證環(huán)境】
- 顯示PHP的版本信息
php -v
-
Apache默認(rèn)的網(wǎng)站根目錄位于
/var/www/html/,進(jìn)入這個(gè)目錄,并創(chuàng)建info.php
sudo nano /var/www/html/info.php
寫入如下內(nèi)容:
<?php
phpinfo();
?>
在瀏覽器中輸入http://localhost/info.php進(jìn)行驗(yàn)證。
【KodExplorer】
按照 https://kodcloud.com/download/ 頁(yè)面的說明,下載KodExplorer并安裝:
cd /var/www/html/
wget http://static.kodcloud.com/update/download/kodexplorer4.25.zip
unzip kodexplorer4.25.zip
chmod -Rf 777 ./*
最后在瀏覽器輸入http://localhost:8000/index.php,如果一切正常即可看到網(wǎng)盤頁(yè)面。
【內(nèi)網(wǎng)穿透】
這一部分不是重點(diǎn),所以簡(jiǎn)單介紹一種方法來實(shí)現(xiàn)遠(yuǎn)程訪問。
從 https://ngrok.com/download 頁(yè)面下載ngrok,樹莓派選擇Linux(ARM)版本進(jìn)行下載。
或者從這里下載并上傳到樹莓派:https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip
cd /home/pi/Desktop/
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip
sudo unzip ngrok-stable-linux-arm.zip
sudo ./ngrok http 80 #這里演示的是80端口,其他端口未測(cè)試。
然后在Forwarding后面跟著的ip:ports -> localhost:80即為遠(yuǎn)程映射地址。
在任意瀏覽器輸入上面的ip:ports即可訪問到本地服務(wù)。
【安裝Mysql5.7】
- 因?yàn)閁buntu14.04下沒有Mysql5.7的源,需要連接外部資源庫(kù)進(jìn)行下載
wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb
sudo dpkg -i mysql-apt-config_0.6.0-1_all.deb
sudo apt-get update
sudo apt-get install mysql-server
# 在安裝過程中要輸入root的密碼
- 安裝完成后,執(zhí)行mysql_secure_installation,根據(jù)提示完成安全設(shè)置
這一步驟中,在手機(jī)上用
linux deploy部署linux執(zhí)行有可能出現(xiàn)錯(cuò)誤
W: GPG error: http://rep.mysql.com/apt/debian jessie InRelease: The following signatures were invalid: KEYEXPIRED 1487236823 KEYEXPIRED 1487236823 KEYEXPIRED 1487236823
w: The repository 'http://repo.mysql.com/apt/debian jessie InRelease' is not signed.
按照https://askubuntu.com/questions/131601/gpg-error-release-the-following-signatures-were-invalid-badsig中的方法:sudo apt-get clean sudo mv /var/lib/apt/lists /tmp sudo mkdir -p /var/lib/apt/lists/partial #這一句可以不執(zhí)行,update的時(shí)候會(huì)自動(dòng)執(zhí)行 sudo apt-get clean sudo apt-get update依次執(zhí)行上面的命令后即可重新安裝其他版本的mysql。