ubuntu网络、包管理、工作内容小结
中国地图
1.配置IP
cat /etc/network/interfaces auto lo iface lo inet loopback # The loopback network interface auto enp6s0f0 iface enp6s0f0 inet static pre-up ifconfig enp6s0f0 hw ether 00:23:81:26:73:31 address 192.168.166.45 netmask 255.255.255.0 gateway 192.168.166.1 dns-nameservers 8.8.8.8 dns-nameservers 202.106.0.20 # 重启网卡 ip addr flush dev ens33 && /etc/init.d/networking restart
2.制作本地下载源
# 如果服务器不能访问外网,那就配一个ISO下载源 mount /dev/sr0 /media/cdrom apt-cdrom -m -d /media/cdrom/ add apt update
3.工作内容小结
# mysql输出总会提示不要用明文的密码,下面这两行可以让其静默 export MYSQL_PWD=$passwd mysql -u$user -e "USE IM_CONFIG;DELETE FROM CEMS_SERVER where os='linux';" -A -N # MySQL初始化语句 /data/linkdood/im/soft/mysql/bin/mysqld --initialize --user=mysql \ --basedir=/data/linkdood/im/soft/mysql --datadir=/data/linkdood/data/mysql/data \ > /data/linkdood/im/soft/mysql/mysql_passwd.log 2>&1 # 在脚本中向MySQL插入数据 mysql -uzbqltest -p'bUj7Rxz#kwrM(alW' -e "USE IM_CONFIG;INSERT INTO CEMS_SERVER VALUES ('',...);" # FastDFS启动 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start /usr/bin/fdfs_storaged /etc/fdfs/storage.conf start /usr/sbin/ntpdate time1.aliyun.com # 配置文件检测命令 /sbin/nginx -t -c /data/linkdood/im/soft/nginx/conf/nginx.conf # nginx启动命令 /sbin/nginx -p /data/linkdood/im/soft/nginx # java服务能启动做了两步, 往/usr/lib下考了个libtched.so 在${JAVA_HOME}/jre/lib/ext目录下放入vsf-codec-1.0-SNAPSHOT.jar 还有依赖关系需要考虑,config和dbconfig等如果启动时间过长,其他服务也会无法启动 # 解决没有sqlhandler的问题 export PATH=$PATH:/data/linkdood/im/soft/mysql/bin yum install gcc libffi-devel python-devel openssl-devel pip install MySQL-python==1.2.5
4.匹配ip
grep -E "[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}" a.txt sed -r "s#(\b[0-9]{1,3}.){3}[0-9]{1,3}\b#${IP}#g" a.txt sed -r "s#([0-9]{1,3}.){3}[0-9]{1,3}#${IP}#g" a.txt
5./etc/profile示例
export MYSQL_HOME=/data/linkdood/im/soft/mysql/bin export JAVA_HOME=/usr/java/jdk1.8.0_191 export PATH=$JAVA_HOME/bin:$MYSQL_HOME:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JRE_HOME=$JAVA_HOME/jre export LD_LIBRARY_PATH=/usr/local/lib/ ulimit -SHn 999999 ulimit -c 999999
Ubuntu制作ISO下载源:https://www.cnblogs.com/0x4D75/p/9443842.html
Ubuntu arm64国内源:https://www.jianshu.com/p/67cb69b55377