該文接續以前寫過的兩篇:html
【樹莓派】服務配置相關java
【樹莓派】服務配置相關2:基於RPi Desktop的服務配置nginx
這是我我的用來進行樹莓派盒子安裝配置的腳本,對於外部其餘博友,能夠部分參考,但不須要逐個引用。web
如今將以前在Ubuntu的一些操做記錄作一下備份,下次若是有相似狀況,就能夠直接引用,而不須要從新折騰一遍。ubuntu
具體部分腳本以下:bash
Step1:網絡配置網絡
sudo cp /etc/network/interfaces /etc/network/interfaces.bak lifeccp@ubuntu:~/webapp/osprey$ cat /etc/network/interfaces auto lo iface lo inet loopback auto enp3s0 iface enp3s0 inet static address 192.168.21.11 netmask 255.255.255.0 gateway 192.168.21.1 dns-nameservers 8.8.8.8
配置DNS:oracle
lifeccp@ubuntu:~/webapp/osprey$ sudo vi /etc/resolv.conf nameserver 61.134.1.4 sudo /etc/init.d/networking restart
在網絡配置的時候,須要有一些其餘的注意事項,參考本文後面的附錄部分;app
Step2:JAVA環境變量配置ssh
JDK下載地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
java -version sudo apt-get install openjdk-8-jre -y export PATH="$PATH:$JAVA_HOME/bin" export JAVA_HOME=/home/lifeccp/JAVA/jdk1.8.0_144 export JRE_HOME=$JAVA_HOME/jre export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH source ~/.bashrc java -version sudo apt-get update
中途竟然遇到問題,部分解決命令以下:
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer sudo update-java-alternatives -s java-8-oracle # Java 檢查 >>> java -version #設置java的環境變量: sudo apt-get install Oracle-java8-set-default
Step3:ssh-key信息
# 退出,使用lifeccp帳戶登陸 ssh-keygen -t rsa tar -cvf ssh.tar.gz .ssh cat .ssh/id_rsa.pub cat .ssh/id_rsa sudo sed -i '$a Welcome!You can send Email to nianhuaiju@qq.com,If the computer malfunctions.' /etc/issue
Step3:服務與自自動項配置
mkdir -p /home/lifeccp/webapp mkdir -p /home/lifeccp/dicom cd /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.jar sudo 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/osprey sudo chmod +x /etc/init.d/osprey sudo chmod +x /etc/init.d/pandion sudo apt-get install tree # sudo apt-get update sudo apt-get install sysv-rc-conf -y sysv-rc-conf --list xxxx alias chkconfig=sysv-rc-conf chkconfig --list sudo sysv-rc-conf --list sysv-rc-conf --list [service name] sysv-rc-conf [--level <runlevels>] <service name> <on|off> sudo sysv-rc-conf osprey on sudo sysv-rc-conf pandion on sudo sysv-rc-conf --list pandion sudo sysv-rc-conf --list osprey
Step4:Nginx等服務配置
sudo apt-get install nginx -y sudo cp /home/lifeccp/webapp/nginx-conf-prod/osprey.conf /etc/nginx/conf.d/osprey.conf sudo 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.conf
(如上,待續...2017-08-29 16:11)