ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
ap_scan=1
fast_reauth=1
country=JP
network={
ssid="ssss"
key_mgmt=WPA-PSK
proto=WPA
pairwise=CCMP TKIP
group=CCMP TKIP
psk="xxxxxx"
id_str="0"
priority=1
}
sudo vi /etc/wpa_supplicant/wpa_supplicant.conf
sudo iwlist wlan0 scan
sudo wpa_cli reconfigure
ifconfig wlan0
rm /etc/wpa_supplicant/.wpa_supplicant.conf.swp
树莓派 配置界面 sudo raspi-config
/etc/dhcpcd.conf 设置静态ip的参数文件
重启网络命令: sudo /etc/init.d/networking restart
https://www.raspberrypi.org/downloads/raspbian/
1、下载镜像,用win32diskimager 刻录到卡中,在本机windows平台安装xshell,或者是putty以便ssh登录到服务器
2、修改卡中的文件,建立ssh的空文件。在根目录下建立wpa_supplicant.conf 文件,此文件会被启动程序cp到 etc/wpa_supplicant目录下,是wlan的配置文件
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
ap_scan=1
fast_reauth=1
country=CN
network={
ssid="ssss"
psk="xxxxxx"
id_str="0"
priority=1
}
3 启动开机,修改静态ip
用putty 通过ssh进入到系统中,pi/raspberry 进入到系统中
/etc/dhcpcd.conf 设置静态ip的参数文件
文件中有注释,仔细看很简单
更改分辨率
sudo vi /boot/config.txt
最后增加几行
hdmi_drive=2
hdmi_group=2
hdmi_mode=85 #720p 60HZ
hdmi_mode=42 #1400*1050 60HZ
#电视设置 720p 50HZ
hdmi_group=1
hdmi_mode=19
更换源
树莓派软件源科大源
sudo vi /etc/apt/sources.list
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
sudo vi /etc/apt/sources.list.d/raspi.list
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/ stretch main ui
用清华园#注释掉原文件内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
参考命令行为:
$ sudo vi /etc/apt/sources.list.d/raspi.list
用#注释掉原文件内容,用以下内容取代:
deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
4 vnc server
sudo raspi-config
图形界面有配置的地方,直接打开即可
为了下一步准备 这里需要一个设置:(打开树莓派设置)
sudo raspi-config
选择5.Interfacing Options
找到VNC(远程桌面) 选择 Yes(是)enable
然后sudo reboot 重启后重新连接ssh
---------------------
增加vnc的5901端口 另外增加一个服务,下面正式开始配置
首先
sudo vi /etc/init.d/vncserver
然后 复制下面的内容 右键粘贴进去
#!/bin/sh
### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop vncserver
### END INIT INFO
# More details see:
# http://www.penguintutor.com/linux/vnc
### Customize this entry
# Set the USER variable to the name of the user to start vncserver under
export USER='pi'
### End customization required
eval cd ~$USER
case "$1" in
start)
# 启动命令行。此处自定义分辨率、控制台号码或其它参数。
su $USER -c '/usr/bin/vncserver -depth 16 -geometry 1024x768 :1'
echo "Starting VNC server for $USER "
;;
stop)
# 终止命令行。此处控制台号码与启动一致。
su $USER -c '/usr/bin/vncserver -kill :1'
echo "vncserver stopped"
;;
*)
echo "Usage: /etc/init.d/vncserver {start|stop}"
exit 1
;;
esac
exit 0
然后 Ctrl+O 回车 保存
然后 Ctrl+X退出文本编辑器
然后 修改权限
sudo chmod 755 /etc/init.d/vncserver
然后 添加开机启动项
sudo update-rc.d vncserver defaults
最后 重启树莓派
sudo reboot
5 shadowsocks server安装
sudo pip3 install https://github.com/shadowsocks/shadowsocks/archive/master.zip
安装完成后可以使用下面这个命令查看Shadowsocks版本:
Bash
sudo ssserver --version
目前会显示“Shadowsocks 3.0.0”。
创建配置文件
创建Shadowsocks配置文件所在文件夹:
Bash
sudo mkdir /etc/shadowsocks
然后创建配置文件:
Bash
sudo vi /etc/shadowsocks/config.json
复制粘贴如下内容(注意修改密码“password”):
{
"server":"::",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"zhlc1234",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false
}
然后按Ctrl + O保存文件,Ctrl + X退出。
测试Shadowsocks配置
Bash
sudo ssserver -c /etc/shadowsocks/config.json
在Shadowsocks客户端添加服务器,如果你使用的是我提供的那个配置文件的话,地址填写你的IPv4地址或IPv6地址,端口号为8388,加密方法为aes-256-cfb,密码为你设置的密码。然后设置客户端使用全局模式,浏览器登录Google试试应该能直接打开了。
这时浏览器登录http://ip138.com/就会显示Shadowsocks服务器的IP啦!
测试完毕,按Ctrl + C关闭Shadowsocks。
配置Systemd管理Shadowsocks
新建Shadowsocks管理文件
Bash
sudo vi /etc/systemd/system/shadowsocks-server.service
复制粘贴:
[Unit]
Description=Shadowsocks Server
After=network.target
[Service]
ExecStart=/usr/local/bin/ssserver -c /etc/shadowsocks/config.json
Restart=on-abort
[Install]
WantedBy=multi-user.target
启动Shadowsocks:
Bash
sudo systemctl start shadowsocks-server
设置开机启动Shadowsocks:
Bash
sudo systemctl enable shadowsocks-server
至此,Shadowsock服务器端的基本配置已经全部完成了!
6 tomcat安装
7 更换软件源 软键盘和中文输入法
sudo vi /etc/apt/sources.list
(1)将文件里的默认的官方软件源用# 注释掉
(2)添加下面的软件源(中国科技大学的软件源 ) (手动添加注意空格)
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
执行命令:(stretch)
sudo vi /etc/apt/sources.list.d/raspi.list
(1)将文件里的默认的官方软件源用# 注释掉
(2)添加下面的软件源(中国科技大学的软件源 )(手动添加注意空格)
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/ stretch main ui
更新
sudo apt-get update
sudo apt-get upgrade
安装中文字体:
系统启动后是没有中文字体的, 打开终端,执行以下配置:
sudo apt-get -y install ttf-wqy-zenhei
安装虚拟键盘
sudo apt-get install matchbox-keyboard
8 视频盒子
修改分辨率
sudo vi /boot/config.txt
hdmi_group=2
hdmi_mode=16
hdmi_ignore_edid=0xa5000080
安装kodi
sudo apt-get install kodi
9 路由器防火墙配置,shadowsocks端口8388,ssh端口2222,tomcat端口
10安装samba
更新一下源:
sudo apt-get update
安装samba
sudo apt-get install samba samba-common-bin
安装完成后,配置/etc/samba/smb.conf文件
在其最后添加以下命令:
[shareExFat]
path = /mnt/myusbdrive
valid users = pi RASPBERRYPI/pi
browseable = yes
read only = no
public = yes
writable = yes
保存后,重启samba服务,输入
/etc/init.d/samba restart
最后添加共享用户:
smbpasswd –a pi #这里我用的pi。
设置开机自启动,编辑/etc/rc.local,添加如下行
/etc/init.d/samba restart
楼主好,从samba 4.5开始,ntlm auth参数默认值由“yes”变为“no”。导致默认情况下使用NTLM级别LAN Manager身份验证的客户端不允许登录Samba服务器,受影响的客户端包括Windows XP、Windows2003等。
解决方法(任选一种都可解决):
1. Samba服务器端smb.conf配置文件中添加“ntlm auth = yes”后重启smb服务。
2. Windows XP客户端修改本地安全设置、安全选项、“网络安全:LAN Manager身份验证级别”的值为“仅发送 NTLMv2响应”
11. 挂载ntfs移动硬盘
我的移动硬盘格式为NTFS。所以需要安装ntfs-3g
sudo apt-get install fuse-utils ntfs-3g
但是,我并没有直接安装成功。。。。。
只能手动一番了:
Download the stable source release (我用的Stable Source Release 2017.3.23)(https://www.tuxera.com/community/open-source-ntfs-3g/)
解压并进入到文件夹后执行 ./configure
make
sudo make install
重启
mount -t ntfs-3g /dev/sda1 /mnt/windows
#安装所需软件包
sudoapt-get installfuse-utils ntfs-3g
#加载内核模块
modprobe fuse
#编辑fstab让移动硬盘开机自动挂载
sudo nano /etc/fstab (增加以下内容可能会导致无法正常进入系统)
#在最后一行添加如下内容
/dev/sda1/mnt/myusbdrive ntfs-3g defaults,noexec,umask=0000 0 0
#保存重启,即可生效
安装exfat文件
sudo apt-get install exfat-fuse exfat-utils
sudo mount -t exfat /dev/sda1 /mnt/myusbdrive
写入开机启动文件 /etc/rc.local
sudo mount -t exfat /dev/sda1 /mnt/myusbdrive
或者把一下命令放入/etc/fstab中
/dev/sda1 /mnt/myusbdrive exfat rw,defaults 0 0
安装aria2 离线下载工具
0x04 安装 aria2:
安装:
sudo apt-get install aria2
建立 aria2 设置文件:
cd /etc
sudo mkdir aria2
cd aria2
#创建空白的 aria2s session 文件
sudo touch /etc/aria2/aria2.session
#创建配置文件
sudo vi /etc/aria2/aria2.conf
编辑配置文件(下载目录按情况自己改):
dir=/mnt/myusbdrive #记得改成自己的
disable-ipv6=true
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
#rpc-listen-port=6800
continue=true
input-file=/etc/aria2/aria2.session
save-session=/etc/aria2/aria2.session
max-concurrent-downloads=3
启动:
sudo aria2c --conf-path=/etc/aria2/aria2.conf -D
把aria2做成系统的服务:
sudo vi /etc/init.d/aria2c
内容如下:
#!/bin/sh
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Aria2 Downloader
### END INIT INFO
case "$1" in
start)
echo -n "Starting aria2c"
sudo -u pi aria2c --conf-path=/etc/aria2/aria2.conf -D
#sudo -u后面的是你正在使用的用户名,因为我用的XBian,用debian的是pi(没改用户的话)
;;
stop)
echo -n "Shutting down aria2c "
killall aria2c
;;
restart)
killall aria2c
sudo -u pi aria2c --conf-path=/etc/aria2/aria2.conf -D
#同上面的一样,根据自己的用户名改xbian。
;;
esac
exit
Ctrl + O 保存后退出
然后设置这个文件的权限。
1
sudo chmod 755 /etc/init.d/aria2c
测试服务是否可以启动:
1
sudo service aria2c start
如果只显示Starting aria2c,没有其他错误提示的话就成功了。
添加aria2c服务自动运行:
1
sudo update-rc.d aria2c defaults
0x05 安装 yaaw:
安装 apache:
sudo apt-get install apache2
给权限:
sudo chmod 777 /var/www/html
cd /var/www/html
安装 yaaw:
sudo git clone https://git.oschina.net/chenxuuu/webui-aria2.git /var/www/html
#你也可以连GitHub,但是速度嘛~ https://github.com/ghostry/webui-aria2.git
然后就可以访问 http:// 树莓派 ip / 来进行离线下载了
13树莓派安装apache2
sudo apt-get install apache2
完成APACHE的在线安装我们可以尝试采用默认配置来启动下APACHE服务,以便查看是否安装正常。重启APACH服务的命令如下;
启动:sudo /etc/init.d/apache2 start
重启:sudo /etc/init.d/apache2 restart
关闭:sudo /etc/init.d/apache2 stop
通过上面的更新和安装APACHE服务就基本安装完成了。
配置APACHE服务
Top
APACHE安装后还是不能直接使用,因为需要更具自己的具体业务需求来更改配置以达到符合自己的实际情况。
apache2的默认主目录:/var/www/
apache2的的配置目录:/etc/apache2
其中sites-enabled,sites-available这两个文件夹是关于虚拟主机的配置,而且在sites-enabled文件夹中基本是sites-available的连接文件。
建立一个TEST虚拟空间目录
在sites-available文件夹中,新建文件TEST,内容如下
就按照default来就行,当然也可以简单点
ServerName TEST.com
DocumentRoot /var/ww/TEST/
然后sudo service apache2 reload重启服务让修改的配置文件生效即可。
apache 可以文件存取服务器
修改网页服务器的配置文件
vi /etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/html
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
可以根据自己的需要修改 DocumentRoot 目录和Directory 目录