批量安装配置盒子时候,可以先安装一个,其余的从这台copy过去。
之前的部分shell记录在本地,记录如下,以免忘记。下次可直接cp执行即可:
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 sudo reboot # 退出,使用lifeccp账户登录
Step2,保存备份sshkey等信息
ssh-keygen -t rsa tar -cvf ssh.tar.gz .ssh cat .ssh/id_rsa.pub > a.txt echo " *********** " >> a.txt cat .ssh/id_rsa >> a.txt echo "***********" >> a.txt # 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 echo "***********" >> a.txt sudo ifconfig >> a.txt cat a.txt cp a.txt a.txt.77 scp /home/lifeccp/a.txt.77 lifeccp@192.168.21.63:/home/lifeccp/info
Step3,安装chkconfig等服务
sudo service ssh start sudo service ssh status --------服务配置 mkdir -p /home/lifeccp/webapp mkdir -p /home/lifeccp/dicom sudo apt-get install chkconfig
Step4,上传或者scp服务
cd /home/lifeccp/webapp 上传文件 scp -r lifeccp@192.168.21.63:/home/lifeccp/webapp/* .
Step5,修改文件权限
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 chkconfig --list sudo chkconfig --add osprey sudo chkconfig --add pandion sudo chkconfig --list pandion sudo chkconfig --list osprey sudo apt-get install nginx -y
Step6,替换部分配置文件与服务
sudo chkconfig --add nginx sudo chkconfig --level 2345 nginx on # sudo apt-get install nginx -y 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 cp /home/lifeccp/webapp/nginx-conf-prod/osprey.conf /etc/nginx/conf.d/osprey.conf sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak sudo cp /home/lifeccp/webapp/nginx-conf-prod/nginx.conf /etc/nginx/nginx.conf # sudo sed -i '1i upstream ef.lifeccp.com { server 59.110.47.149:80 max_fails=2 fail_timeout=30s ; } ' /etc/nginx/conf.d/osprey.conf sudo 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
Step7,补充网络配置
sudo sed -i '$a interface eth0 static ip_address=192.168.21.77/24 static routers=192.168.21.1 #static domain_name_servers=218.30.19.40 61.134.1.4 static domain_name_servers=223.5.5.5 223.6.6.6' /etc/dhcpcd.conf
或者
sudo vi /etc/dhcpcd.conf interface eth0 static ip_address=192.168.21.10/24 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
(待后续更新)