1.執(zhí)行命令帶sudo時(shí)出現(xiàn) sudo: unable to resolve host NRatel
原因,我使用的是阿里云服務(wù)器,修改了實(shí)例(主機(jī))名稱
解決:/etc/hosts中添加一行
127.0.0.1 NRatel #NRatel是主機(jī)名。
2.如何從windows傳文件到linux服務(wù)器
方式一: 使用putty.
上傳: cmd中輸入命令
pscp C:\Users\Administrator\Desktop\x.txt niehongqiang@59.110.226.33:/home/niehongqiang/test
下載: cmd中輸入命令
pscp niehongqiang@59.110.226.33:/home/niehongqiang/test/x.txt C:\Users\Administrator\Desktop
方式二: 使用WinSCP.
界面里選擇文件->上傳/下載 或 拖拽
方式三: 使用xshell+xftp
界面里拖拽
3.如何改apache2的默認(rèn)訪問路徑
2.4版:
修改 DocumentRoot: /etc/apache2/sites-enabled/000-default.conf
修改對(duì)應(yīng)的Directory標(biāo)簽: /etc/apache2/apache2.conf
改完重啟: sudo /etc/init.d/apache2 restart
4.Failed to restart apache2.service
四步走
sudo /etc/init.d/apache2 stop
sudo killall apache2
sudo netstat -l|grep www # 確認(rèn)沒有服務(wù)占用80端口
sudo /etc/init.d/apache2 restart
5. 修改文件權(quán)限時(shí) 遇到 changing permissions of 'xxx': Operation not permitted
汗、、、加上sudo
6. 玩wordpress時(shí),不能安裝新的主題,"安裝失?。簾o法創(chuàng)建目錄"
將wordpress所在目錄所有者設(shè)為 www-data:niehongqiang, 并將該目錄讀寫權(quán)限設(shè)為775
這樣www-data可以寫入, niehongqiang用戶組的niehongqiang用戶也可以寫入了。
sudo chown -R www-data /var/www/html
順便記一下:
查看文件信息: ls -l
查看當(dāng)前登錄用戶名: whoami
查看用戶: cat /etc/passwd
查看用戶組: cat /etc/group
ls -l 各列的含義:
http://blog.csdn.net/zhuoya_/article/details/77418413
用戶及用戶組管理、cat /etc/passwd內(nèi)容解答:
http://www.92csz.com/study/linux/7.htm
7. 安裝前查看apt-get中的后選版本?
apt-cache policy xxx