该文接续之前写过的两篇:
【树莓派】服务配置相关2:基于RPi Desktop的服务配置
这是我个人用来进行树莓派盒子安装配置的脚本,对于外部其他博友,可以部分参考,但不需要逐个引用。
现在将之前在Ubuntu的一些操作记录做一下备份,下次如果有类似情况,就可以直接引用,而不需要重新折腾一遍。
具体部分脚本如下:
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:
lifeccp@ubuntu:~/webapp/osprey$ sudo vi /etc/resolv.conf
nameserver 61.134.1.4 sudo /etc/init.d/networking restart
在网络配置的时候,需要有一些其他的注意事项,参考本文后面的附录部分;
Step2:JAVA环境变量配置
JDK下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
java -version
sudo apt-get install openjdk--jre -y
export PATH="$PATH:$JAVA_HOME/bin" export JAVA_HOME=/home/lifeccp/JAVA/jdk1..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--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)