批量安装配置盒子时候,可以先安装一个,其余的从这台copy过去。
之前的部分shell记录在本地,记录如下,以免忘记。下次可直接cp执行即可:
Step1, 创建用户/组
sudo groupadd wingspansudo useradd -g wingspan -d /home/lifeccp -m lifeccp -p lifeccpsudo cp /etc/sudoers /etc/sudoers.default.baksudo sed -i '21a lifeccp ALL=(ALL:ALL) ALL' /etc/sudoerssudo passwd lifeccp#sudo visudosudo reboot# 退出,使用lifeccp账户登录
Step2,保存备份sshkey等信息
ssh-keygen -t rsatar -cvf ssh.tar.gz .sshcat .ssh/id_rsa.pub > a.txtecho "\n***********\n" >> a.txtcat .ssh/id_rsa >> a.txtecho "***********" >> a.txt# get infosudo cat /proc/cpuinfo | grep Serial | awk '{print $3}' >> a.txtsudo ifconfig | grep HWaddr >> a.txtsudo ifconfig | grep HWaddr | awk '{print $5}' >> a.txtecho "***********" >> a.txtsudo ifconfig >> a.txtcat a.txtcp a.txt a.txt.77scp /home/lifeccp/a.txt.77 lifeccp@192.168.21.63:/home/lifeccp/info
Step3,安装chkconfig等服务
sudo service ssh startsudo service ssh status--------服务配置mkdir -p /home/lifeccp/webappmkdir -p /home/lifeccp/dicomsudo 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/servesudo chmod +x /home/lifeccp/webapp/pandion/startupsudo chmod +x /home/lifeccp/webapp/pandion/pandion-v1.0.7.release.jarsudo chmod +x /home/lifeccp/webapp/osprey/servesudo chmod +x /home/lifeccp/webapp/osprey/startupsudo chmod +x /home/lifeccp/webapp/osprey/osprey-v1.0.21.release.jar*sudo cp /home/lifeccp/webapp/pandion/serve /etc/init.d/pandionsudo cp /home/lifeccp/webapp/osprey/serve /etc/init.d/ospreysudo chmod +x /etc/init.d/ospreysudo chmod +x /etc/init.d/pandionsudo chkconfig --listsudo chkconfig --add ospreysudo chkconfig --add pandionsudo chkconfig --list pandionsudo chkconfig --list ospreysudo apt-get install nginx -y
Step6,替换部分配置文件与服务
sudo chkconfig --add nginxsudo chkconfig --level 2345 nginx on# sudo apt-get install nginx -ysudo cp /etc/hosts /etc/hosts.baksudo sed -i '$a 59.110.47.149 ef.lifeccp.com' /etc/hostssudo cp /etc/nginx/conf.d/osprey.conf /etc/nginx/conf.d/osprey.conf.baksudo cp /home/lifeccp/webapp/nginx-conf-prod/osprey.conf /etc/nginx/conf.d/osprey.confsudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.baksudo cp /home/lifeccp/webapp/nginx-conf-prod/nginx.conf /etc/nginx/nginx.conf# 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/motdsudo userdel -rf pisudo groupdel pi
Step7,补充网络配置
sudo sed -i '$a \n\ninterface eth0\n static ip_address=192.168.21.77/24\n static routers=192.168.21.1\n #static domain_name_servers=218.30.19.40 61.134.1.4\n static domain_name_servers=223.5.5.5 223.6.6.6' /etc/dhcpcd.conf
或者
sudo vi /etc/dhcpcd.confinterface eth0static ip_address=192.168.21.10/24static routers=192.168.21.1#static domain_name_servers=223.5.5.5 223.6.6.6static domain_name_servers=218.30.19.40 61.134.1.4
(待后续更新)