命令:
sudo apt-get purge --卸载
sudo apt-get install --安装
sudo apt autoremove --自动卸载
--开启 ll 别名
vim ~/.bashrc 编辑文件
取消注释 alias ll=’ls -l’
source ~/.bashrc
-----更换源
需要特别注意!上面的 jessie 这个属性要与你的系统相匹配!
如果你的系统基于 Debian jessie 的就写 jessie,如果是基于 Debian wheezy 的就写 wheezy。
我之前犯了错误,我的系统是 jessie 的但是却复制别人的写了 wheezy,导致后来我安装 QT5 始终找不到安装包!
sudo vim /etc/apt/sources.list
deb http://mirrors.aliyun.com/raspbian/raspbian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ stretch main non-free contrib
sudo apt-get update #更新系统软件
sudo apt-get upgrade #更新已安装的包
sudo apt-get dist-upgrade #更新依赖
------安装 vim
sudo apt-get install vim
--开启 wifi 配置
vim /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="WiFi name"
psk="12345678"
}
/etc/init.d/networking restart
-----调整时间
sudo dpkg-reconfigure tzdata
-----安装 shadowsocks
sudo apt-get install shadowsocks
json 配置:
{
"server":"103.238.225.66",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1081,
"password":"123#dQabcd",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": true,
"prefer_ipv6" : false
}
启动脚本:
#!/bin/sh
case $1 in
start)
killall ssserver
ssserver -c /home/conf/shadowsocks/shadowsocks.json -d start
echo "shadowsocks is start"
;;
stop)
killall ssserver
echo "shadowsocks is stop"
;;
restart)
killall ssserver
echo "shadowsocks is stop"
ssserver -c /home/conf/shadowsocks/shadowsocks.json -d start
echo "shadowsocks is start"
;;
*)
echo "command is not found"
exit 1
;;
esac
----安装 chkconfig
sudo apt-get install chkconfig
-----代理设置
sudo apt-get install privoxy
编辑 /etc/privoxy/config 文件,在最后添加这几行配置:
forward-socks5 / 127.0.0.1:1080 .
listen-address 127.0.0.1:8118
local network do not use proxy
forward 192.168../ .
forward 10.../ .
forward 127.../ .
forward-socks5 这一行表示所有网络通过 socks5 代理,代理服务器是 127.0.0.1:1080,即在本机启动的 Shadowsocks 客户端服务。最后三行是本地局域网不使用代理的配置。
重启一下 privoxy:
sudo service privoxy restart
------apt-get 代理设置
如果只是希望 apt-get 使用代理,可以这样:
在终端下编辑/etc/apt/apt.conf 加入下面这行,
Acquire::http::Proxy "http://yourproxyaddress:proxyport"; (上面--代理设置转换了用 http://127.0.0.1:8118)
保存退出 apt.conf。
-------树莓派的 root 账户 ssh 登录设置
首先,用 pi 用户登录(默认密码是 raspberry)后,执行 sudo passwd root 命令,修改 root 密码;
然后,编辑 vim /etc/ssh/sshd_config 文件,找到 PermitRootLogin 一行;
如果之前执行过 sudo passwd --unlock root 的话,这里可能会显示 without-passwd 什么的,
把这行修改为“PermitRootLogin yes”,保存退出然后重启系统,root 账号应该可以直接登录了。
-----------------------------------------------------------------------------安装 python
安装 python 需要的依赖
sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
tar zxvf Python-3.5.0.tgz
配置、编译、安装
sudo mkdir /usr/local/python3
sudo ./configure --prefix=/usr/local/python3
sudo make
sudo make install
创建符号链接
sudo rm /usr/bin/python3
sudo rm /usr/bin/pip3
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3
sudo ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
测试安装成功
python3
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 100
----------------------------------------------------------------------------树莓派信息显示
import os
Return CPU temperature as a character string
def getCPUtemperature():
res = os.popen('vcgencmd measure_temp').readline()
return(res.replace("temp=","").replace("'C\n",""))
Return RAM information (unit=kb) in a list
Index 0: total RAM
Index 1: used RAM
Index 2: free RAM
def getRAMinfo():
p = os.popen('free')
i = 0
while 1:
i = i + 1
line = p.readline()
if i==2:
return(line.split()[1:4])
Return % of CPU used by user as a character string
def getCPUuse():
return(str(os.popen("top -n1 | awk '/Cpu(s):/ {print $2}'").readline().strip()))
Return information about disk space as a list (unit included)
Index 0: total disk space
Index 1: used disk space
Index 2: remaining disk space
Index 3: percentage of disk used
def getDiskSpace():
p = os.popen("df -h /")
i = 0
while 1:
i = i +1
line = p.readline()
if i==2:
return(line.split()[1:5])
CPU informatiom
CPU_temp = getCPUtemperature()
CPU_usage = getCPUuse()
RAM information
Output is in kb, here I convert it in Mb for readability
RAM_stats = getRAMinfo()
RAM_total = round(int(RAM_stats[0]) / 1000,1)
RAM_used = round(int(RAM_stats[1]) / 1000,1)
RAM_free = round(int(RAM_stats[2]) / 1000,1)
Disk information
DISK_stats = getDiskSpace()
DISK_total = DISK_stats[0]
DISK_used = DISK_stats[1]
DISK_perc = DISK_stats[3]
if name == 'main':
print('')
print('CPU Temperature = '+CPU_temp)
print('CPU Use = '+CPU_usage)
print('')
print('RAM Total = '+str(RAM_total)+' MB')
print('RAM Used = '+str(RAM_used)+' MB')
print('RAM Free = '+str(RAM_free)+' MB')
print('')
print('DISK Total Space = '+str(DISK_total)+'B')
print('DISK Used Space = '+str(DISK_used)+'B')
print('DISK Used Percentage = '+str(DISK_perc))
----------------------------------------------------------------------------树莓派信息显示
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于