该文接续之前写过的一篇:【树莓派】服务配置相关。
这是我个人用来进行树莓派盒子安装配置的脚本,对于外部其他博友,可以部分参考,但不需要逐个引用。
现在有一定更新,部分按如下脚本来操作:
step1:
sudo groupadd wingspan
sudo useradd -g wingspan -d /home/lifeccp -m lifeccp -p lifeccp
sudo cp /etc/sudoers /etc/sudoers.default.bak
sudo sed -i '21a lifeccp ALL=(ALL:ALL) ALL' /etc/sudoers
sudo passwd lifeccp
#sudo visudo
step2:
# 退出,使用lifeccp账户登录
ssh-keygen -t rsa
tar -cvf ssh.tar.gz .ssh
cat .ssh/id_rsa.pub
cat .ssh/id_rsa# get info
sudo cat /proc/cpuinfo | grep Serial | awk '{print $3}' > a.txt
sudo ifconfig | grep HWaddr >> a.txt
sudo ifconfig | grep HWaddr | awk '{print $5}' >> a.txt
cat a.txt
step3:
sudo service ssh start
sudo service ssh status
--------服务配置
mkdir -p /home/lifeccp/webapp
mkdir -p /home/lifeccp/dicomsudo apt-get install chkconfigcd /home/lifeccp/webapp
上传文件
sudo chmod +x /home/lifeccp/webapp/pandion/serve
sudo chmod +x /home/lifeccp/webapp/pandion/startup
sudo chmod +x /home/lifeccp/webapp/pandion/pandion-v1.0.7.release.jarsudo chmod +x /home/lifeccp/webapp/osprey/serve
sudo chmod +x /home/lifeccp/webapp/osprey/startup
sudo chmod +x /home/lifeccp/webapp/osprey/osprey-v1.0.21.release.jar*sudo cp /home/lifeccp/webapp/pandion/serve /etc/init.d/pandion
sudo cp /home/lifeccp/webapp/osprey/serve /etc/init.d/ospreysudo chmod +x /etc/init.d/osprey
sudo chmod +x /etc/init.d/pandionsudo chkconfig --list
sudo chkconfig --add osprey
sudo chkconfig --add pandion
sudo chkconfig --list pandion
sudo chkconfig --list osprey
step4:
sudo apt-get install nginx -y
sudo chkconfig --add nginx
sudo chkconfig --level nginx on
# sudo apt-get install nginx -y
sudo cp /home/lifeccp/webapp/nginx-conf-prod/osprey.conf /etc/nginx/conf.d/osprey.confsudo cp /etc/hosts /etc/hosts.bak
sudo sed -i '$a 59.110.47.149 ef.lifeccp.com' /etc/hosts
sudo cp /etc/nginx/conf.d/osprey.conf /etc/nginx/conf.d/osprey.conf.bak
# sudo sed -i '1i upstream ef.lifeccp.com { \n server 59.110.47.149:80 max_fails=2 fail_timeout=30s ; \n } ' /etc/nginx/conf.d/osprey.confsudo sed -i '5i Welcome!You can send Email to nianhuaiju@qq.com,If the computer malfunctions.' /etc/motd
sudo userdel -rf pi
sudo groupdel pi
step5:
sudo vi /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.21.135/
static routers=192.168.21.1
#static domain_name_servers=223.5.5.5 223.6.6.6
static domain_name_servers=218.30.19.40 61.134.1.4
或者:
sudo sed -i '$a interface eth1\n static ip_address=192.168.21.135/24\n static routers=192.168.21.1\n #static domain_name_servers=218.30.19.40 61.134.1.4' /etc/dhcpcd.conf
# sudo sed -i '$a # static domain_name_servers=223.5.5.5 223.6.6.6' /etc/dhcpcd.conf
step6:重启
sudo reboot
step7:
(待续)