1. 程式人生 > >初玩樹莓派所遇見的坑

初玩樹莓派所遇見的坑

1 樹莓派apt國內源修改

系統自帶的源下載過慢,使用阿里雲源或清華大學源
給出地址:
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib

操作步驟為:

#備份為 sources.list.bak
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak   
#編輯sources.list  檔案
sudo vim /etc/apt/sources.list

修改源後,還可能不能下載,可將/etc/apt/sources.list.d/raspi.list中的內容給註釋掉…

2 Apache2啟動錯誤

使用
sudo apt-get install apache2安裝Apache2,
使用sudo service apache2 start,竟然提示
Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for deta

使用sudo journalctl -xn

詳細檢視錯誤部分

-- Logs begin at Wed 2016-12-21 16:54:46 CST, end at Thu 2016-12-22 09:19:46 CST. --
Dec 22 09:19:28 raspberrypi apache2[10170]: Output of config test was:
Dec 22 09:19:28 raspberrypi apache2[10170]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Could not open configuratio
Dec 22 09:19:28 raspberrypi apache2[10170]: Action 'configtest' failed.
Dec 22 09:19:28 raspberrypi apache2[10170]: The Apache error log may have more information.
Dec 22 09:19:29 raspberrypi systemd[1]: apache2.service: control process exited, code=exited status=1
Dec 22 09:19:29 raspberrypi systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject
: Unit apache2.service has failed
-- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit apache2.service has failed. -- -- The result is failed. Dec 22 09:19:29 raspberrypi systemd[1]: Unit apache2.service entered failed state. Dec 22 09:19:29 raspberrypi sudo[10162]: pam_unix(sudo:session): session closed for user root Dec 22 09:19:46 raspberrypi sudo[10303]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -xn

提示.conf檔案不能開啟,猜想可能是一些包可能被刪除或缺少了,之前又安裝了php5,於是乎將PHP5重灌了…竟然好了…
(完全刪除:sudo apt-get purge apache2