首页
关于
壁纸
直播
留言
友链
统计
Search
1
《三国志英杰传》攻略
6,036 阅读
2
白嫖Emby
5,772 阅读
3
Emby客户端IOS破解
5,772 阅读
4
《吞食天地1》金手指代码
4,699 阅读
5
破解emby-server
4,041 阅读
moonjerx
game
age-of-empires
zx3
san-guo-zhi
尼尔:机械纪元
net
emby
learn-video
docker
torrent
photoshop
route
minio
git
ffmpeg
im
vue
gitlab
typecho
svn
alipay
nasm
srs
mail-server
tailscale
kkfileview
aria2
webdav
synology
redis
oray
chemical
mxsite
math
π
x-ui
digital-currency
server
nginx
baota
k8s
http
cloud
linux
shell
database
vpn
esxi
rancher
domain
k3s
ewomail
os
android
windows
ios
app-store
macos
develop
java
javascript
uniapp
nodejs
hbuildx
maven
android-studio
jetbrain
jenkins
css
mybatis
php
python
hardware
hard-disk
pc
RAM
software
pt
calibre
notion
office
language
literature
philosophy
travel
登录
Search
标签搜索
ubuntu
mysql
openwrt
zerotier
springboot
centos
openvpn
jdk
吞食天地2
synology
spring
idea
windows11
吞食天地1
transmission
google-play
Japanese
xcode
群晖
kiftd
MoonjerX
累计撰写
370
篇文章
累计收到
459
条评论
首页
栏目
moonjerx
game
age-of-empires
zx3
san-guo-zhi
尼尔:机械纪元
net
emby
learn-video
docker
torrent
photoshop
route
minio
git
ffmpeg
im
vue
gitlab
typecho
svn
alipay
nasm
srs
mail-server
tailscale
kkfileview
aria2
webdav
synology
redis
oray
chemical
mxsite
math
π
x-ui
digital-currency
server
nginx
baota
k8s
http
cloud
linux
shell
database
vpn
esxi
rancher
domain
k3s
ewomail
os
android
windows
ios
app-store
macos
develop
java
javascript
uniapp
nodejs
hbuildx
maven
android-studio
jetbrain
jenkins
css
mybatis
php
python
hardware
hard-disk
pc
RAM
software
pt
calibre
notion
office
language
literature
philosophy
travel
页面
关于
壁纸
直播
留言
友链
统计
搜索到
54
篇与
linux
的结果
2022-07-12
shell命令:判断文件或目录是否存在
一、文件比较符-e filename 如果 filename 存在,则为真-d filename 如果 filename 为目录,则为真-f filename 如果 filename 为常规文件,则为真-L filename 如果 filename 为符号链接,则为真-r filename 如果 filename 可读,则为真-w filename 如果 filename 可写,则为真-x filename 如果 filename 可执行,则为真 -s filename 如果 文件长度不为0,则为真 -h filename 如果 文件是软链接,则为真-O filename 如果 filename 存在,并且属于当前用户,则为真-G filename 如果 filename 存在,并且属于当前用户组,则为真-nt 判断file1是否比file2新 ["/data/file1" -nt"/data/file2" ]-ot 判断file1是否比file2旧 ["/data/file1" -ot"/data/file2" ]二、常用例子1,文件夹不存在则创建if [ ! -d "/data/" ]; then mkdir /data else echo "文件夹已经存在" fi2,文件存在则删除if [ ! -f "/data/filename" ]; then echo "文件不存在" else rm -f /data/filename fi3,判断文件是否存在,不存在则创建if [ ! -f "$file" ]; then touch "$file" fi4,文件夹是否存在if [ -d "/data/" ]; then echo "文件夹存在" else echo "文件夹不存在" fi
2022年07月12日
83 阅读
0 评论
0 点赞
2022-06-09
Linux之svn数据备份、还原及迁移
(本文例子基于FreeBSD/Linux实现,windows环境请自己做出相应修改)配置管理的一个重要使命是保证数据的安全性,防止服务器应硬盘损坏、误操作造成数据无法恢复的灾难性后果。因此制定一个完整的备份策略非常重要。一般来说,备份策略应规定如下几部分内容:备份频度、备份方式、备份存放地点、备份责任人、灾难恢复检查措施及规定。备份频度、存放地点等内容可以根据自己的实际情况自行制定;本文重点描述备份方式。svn备份一般采用三种方式:1)svnadmin dump 2)svnadmin hotcopy 3)svnsync.注意,svn备份不宜采用普通的文件拷贝方式(除非你备份的时候将库暂停),如copy命令、rsync命令。笔者曾经用 rsync命令来做增量和全量备份,在季度备份检查审计中,发现备份出来的库大部分都不可用,因此最好是用svn本身提供的功能来进行备份。优缺点分析:第一种svnadmin dump是官方推荐的备份方式,优点是比较灵活,可以全量备份也可以增量备份,并提供了版本恢复机制。缺点是:如果版本比较大,如版本数增长到数万、数十万,那么dump的过程将非常慢;备份耗时,恢复更耗时;不利于快速进行灾难恢复。个人建议在版本数比较小的情况下使用这种备份方式。第二种svnadmin hotcopy原设计目的估计不是用来备份的,只能进行全量拷贝,不能进行增量备份;优点是:备份过程较快,灾难恢复也很快;如果备份机上已经搭建了svn服务,甚至不需要恢复,只需要进行简单配置即可切换到备份库上工作。缺点是:比较耗费硬盘,需要有较大的硬盘支持(俺的备份机有1TB空间,呵呵)。第三种svnsync实际上是制作2个镜像库,当一个坏了的时候,可以迅速切换到另一个。不过,必须svn1.4版本以上才支持这个功能。优点是:当制作成2个镜像库的时候起到双机实时备份的作用;缺点是:当作为2个镜像库使用时,没办法做到“想完全抛弃今天的修改恢复到昨晚的样子”;而当作为普通备份机制每日备份时,操作又较前2种方法麻烦。下面具体描述这三种的备份的方法:1、svnadmin dump备份工具这是subversion官方推荐的备份方式。1)定义备份策略:备份频度:每周六进行一次全量备份,每周日到周五进行增量备份备份地点:备份存储路径到/home/backup/svn/备份命名:全量备份文件名为: weekly_fully_backup.yymmdd ,增量备份文件命名为: daily-incremental-backup.yymmdd 备份时间:每晚21点开始备份检查:每月末进行svnadmin load恢复试验。2)建立全量备份脚本:在~/下建立一个perl脚本文件,名为weekly_backup.pl,执行全量备份,并压缩备份文件,代码如下(本代码只针对一个库的备份,如果是多个库请做相应改动):#!/usr/bin/perl -w my $svn_repos="/home/svn/repos/project1"; my $backup_dir="/home/backup/svn/"; my $next_backup_file = "weekly_fully_backup.".`date +%Y%m%d`; $youngest=`svnlook youngest $svn_repos`; chomp $youngest; print "Backing up to revision $youngest/n"; my $svnadmin_cmd="svnadmin dump --revision 0:$youngest $svn_repos >$backup_dir/$next_backup_file"; `$svnadmin_cmd`; open(LOG,">$backup_dir/last_backed_up"); #记录备份的版本号 print LOG $youngest; close LOG; #如果想节约空间,则再执行下面的压缩脚本 print "Compressing dump file.../n"; print `gzip -g $backup_dir/$next_backup_file`;3)建立增量备份脚本:在全量备份的基础上,进行增量备份:在~/下建立一个perl脚本文件,名为:daily_backup.pl,代码如下:#!/usr/bin/perl -w my $svn_repos="/home/svn/repos/project1"; my $backup_dir="/home/backup/svn/"; my $next_backup_file = "daily_incremental_backup.".`date +%Y%m%d`; open(IN,"$backup_dir/last_backed_up"); $previous_youngest = <IN>; chomp $previous_youngest; close IN; $youngest=`svnlook youngest $svn_repos`; chomp $youngest; if ($youngest eq $previous_youngest) { print "No new revisions to backup./n"; exit 0; } my $first_rev = $previous_youngest + 1; print "Backing up revisions $youngest .../n"; my $svnadmin_cmd = "svnadmin dump --incremental --revision $first_rev:$youngest $svn_repos > $backup_dir/$next_backup_file"; `$svnadmin_cmd`; open(LOG,">$backup_dir/last_backed_up"); #记录备份的版本号 print LOG $youngest; close LOG;如果想节约空间,则再执行下面的压缩脚本print "Compressing dump file.../n"; print `gzip -g $backup_dir/$next_backup_file`;4)配置/etc/crontab文件配置 /etc/crontab 文件,指定每周六执行weekly_backup.pl,指定周一到周五执行daily_backup.pl;具体步骤俺就不啰嗦了.5)备份恢复检查在月底恢复检查中或者在灾难来临时,请按照如下步骤进行恢复:恢复顺序从低版本逐个恢复到高版本;即,先恢复最近的一次完整备份weekly_full_backup.071201(举例),然后恢复紧挨着这个文件的增量备份daily_incremental_backup.071202,再恢复后一天的备份071203,依次类推。如下:user1>mkdir newrepos user1>svnadmin create newrepos user1>svnadmin load newrepos < weekly_full_backup.071201 user1>svnadmin load newrepos < daily_incremental_backup.071202 user1>svnadmin load newrepos < daily_incremental_backup.071203 ....如果备份时采用了gzip进行压缩,恢复时可将解压缩和恢复命令合并,简单写成:user1>zcat weekly_full_backup.071201 | svnadmin load newrepos user1>zcat daily_incremental_backup.071202 | svnadmin load newrepos ...(这部分内容很多参考了《版本控制之道》)2、svnadmin hotcopy整库拷贝方式svnadmin hotcopy是将整个库都“热”拷贝一份出来,包括库的钩子脚本、配置文件等;任何时候运行这个脚本都得到一个版本库的安全拷贝,不管是否有其他进程正在使用版本库。因此这是俺青睐的备份方式。1)定义备份策略备份频度:每天进行一次全量备份,备份地点:备份目录以日期命名,备份路径到 /home/backup/svn/${mmdd}备份保留时期:保留10天到15天,超过15天的进行删除。备份时间:每晚21点开始备份检查:备份完毕后自动运行检查脚本、自动发送报告。2)建立备份脚本在自己home目录 ~/下创建一个文件,backup.sh:#!/bin/bash SRCPATH=/home/svn/repos/; #定义仓库parent路径 DISTPATH=/home/backup/svn/`date +/%m%d`/ ; #定义存放路径; if [ -d "$DISTPATH" ] then else mkdir $DISTPATH chmod g+s $DISTPATH fi echo $DISTPATH svnadmin hotcopy $SRCPATH/Project1 $DISTPATH/Project1 >/home/backup/svn/cpreport.log 2>&1; svnadmin hotcopy $SRCPATH/Project2 $DISTPATH/Project2 cp $SRCPATH/access $DISTPATH; #备份access文件 cp $SRCPATH/passwd $DISTPATH; #备份passwd文件 perl /home/backup/svn/backup_check.pl #运行检查脚本 perl /home/backup/svn/deletDir.pl #运行删除脚本,对过期备份进行删除。3)建立检查脚本在上面指定的地方/home/backup/svn/下建立一个perl脚本:backup_check.pl备份完整性检查的思路是:对备份的库运行 svnlook youngest,如果能正确打印出最新的版本号,则表明备份文件没有缺失;如果运行报错,则说明备份不完整。我试过如果备份中断,则运行svnlook youngest会出错。perl脚本代码如下:#! /usr/bin/perl ## Author:xuejiang ## 2007-11-10 ## http://www.scmbbs.com use strict; use Carp; use Net::SMTP; #### defined the var ####### my $smtp =Net::SMTP->new('mail.scmbbs.com', Timeout => 30, Debug => 0)|| die "cann't connect to mail.scmbbs.com/n"; my $bkrepos="/home/backup/svn/".&get_day;#定义备份路径 my $ssrepos="http://www.scmbbs.com/repos";#定义仓库url my @repos = ("project1","project2"); my $title="echo /"如下是昨晚备份结果与真实库对比的情况,如果给出备份版本数,则表示备份成功;如果给报错信息或没有备份版本数,则表示备份失败:/" >./report"; system $title || die "exec failed/n"; foreach my $myrepos(@repos) { my $bkrepos1=$bkrepos."/".$myrepos; my $ssrepos1=$ssrepos."/".$myrepos; my $svnlookbk1 = "echo /"$myrepos 昨晚备份的版本是:/">>./report;svnlook youngest ".$bkrepos1." >> ./report 2>&1"; my $svnlookss1 = "echo /"$myrepos 真实库中的最新版本及最后修改时间是:/">>./report;svn log -r'HEAD' ".$ssrepos1." >> ./report 2>&1"; system $svnlookbk1 || die "exec failed/n"; system $svnlookss1 || die "exec failed/n"; } my $body ="echo /"=========================================================================/" >>./report"; my $bottom ="echo /"备份位置:来自http://www.scmbbs.com的".$bkrepos."/" >>./report"; system $body || die "exec failed/n"; system $bottom || die "exec failed/n"; ###### report the result #### open(SESAME,"./report")|| die "can not open ./report"; my @svnnews = <SESAME>; close(SESAME); foreach my $line1 (@svnnews) { print $line1."/n"; } my @email_addresses =("scm/@list.scmbbs.com","leader1/@scmbbs.com","leader2/@scmbbs.com"); my $to = join(', ', @email_addresses); $smtp->mail("scm/@scmbbs.com"); $smtp->recipient(@email_addresses); $smtp->data(); $smtp->datasend("To:$to/n"); $smtp->datasend("From: svnReport/@scmbbs.com/n"); $smtp->datasend("Subject:svn备份检查报告".&get_today."/n"); $smtp->datasend("Reply-to:scm/@scmbbs.com/n"); $smtp->datasend("@svnnews"); $smtp->dataend(); $smtp->quit; ############# sub get_today { my( $sec, $min, $hour, $day, $month, $year ) = localtime( time() ); $year += 1900; $month++; my $today = sprintf( "%04d%02d%02d", $year, $month, $day); return $today; } sub get_day { my( $sec, $min, $hour, $day, $month, $year ) = localtime( time() ); $year += 1900; $month++; my $today = sprintf( "%02d%02d", $month, $day); return $today; }4)定义删除脚本由于是全量备份,所以备份不宜保留太多,只需要保留最近10来天的即可,对于超过15天历史的备份基本可以删除了。在/home/backup/svn/下建立一个perl脚本:deletDir.pl(注意,删除svn备份库可不像删除普通文件那么简单)脚本代码请参看我的另一个帖子:http://www.scmbbs.com/cn/systp/2007/12/systp6.php5)修改/etc/crontab 文件在该文件中指定每晚21点执行“backup.sh”脚本。3、svnsync备份参阅:http://www.scmbbs.com/cn/svntp/2007/11/svntp4.php使用svnsync备份很简单,步骤如下:1)在备份机上创建一个空库:svnadmin create Project12)更改该库的钩子脚本pre-revprop-change(因为svnsync要改这个库的属性,也就是要将源库的属性备份到这个库,所以要启用这个脚本):cd SMP/hooks; cp pre-revprop-change.tmpl pre-revprop-change; chmod 755 pre-revprop-change; vi pre-revprop-change; 将该脚本后面的三句注释掉,或者干脆将它弄成一个空文件。 3)初始化,此时还没有备份任何数据: svnsync init file:///home/backup/svn/svnsync/Project1/ http://svntest.subversion.com/repos/Project1语法是:svnsync init {你刚创建的库url} {源库url}注意本地url是三个斜杠的:///4)开始备份(同步):svnsync sync file:///home/backup/svn/svnsync/Project15)建立同步脚本备份完毕后,建立钩子脚本进行同步。在源库/hooks/下建立/修改post-commit脚本,在其中增加一行,内容如下:/usr/bin/svnsync sync --non-interactive file:///home/backup/svn/svnsync/Project1你可能已经注意到上面的备份似乎都是本地备份,不是异地备份。实际上,我是通过将远程的备份机mount(请参阅mount命令)到svn服务器上来实现的,逻辑上看起来是本地备份,物理上实际是异地备份。
2022年06月09日
133 阅读
0 评论
0 点赞
2022-06-09
宝塔面板安装脚本
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH LANG=en_US.UTF-8 if [ $(whoami) != "root" ];then echo "请使用root权限执行宝塔安装命令!" exit 1; fi is64bit=$(getconf LONG_BIT) if [ "${is64bit}" != '64' ];then Red_Error "抱歉, 当前面板版本不支持32位系统, 请使用64位系统或安装宝塔5.9!"; fi Centos6Check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat') if [ "${Centos6Check}" ];then echo "Centos6不支持安装宝塔面板,请更换Centos7/8安装宝塔面板" exit 1 fi UbuntuCheck=$(cat /etc/issue|grep Ubuntu|awk '{print $2}'|cut -f 1 -d '.') if [ "${UbuntuCheck}" -lt "16" ];then echo "Ubuntu ${UbuntuCheck}不支持安装宝塔面板,建议更换Ubuntu18/20安装宝塔面板" exit 1 fi cd ~ setup_path="/www" python_bin=$setup_path/server/panel/pyenv/bin/python cpu_cpunt=$(cat /proc/cpuinfo|grep processor|wc -l) if [ "$1" ];then IDC_CODE=$1 fi GetSysInfo(){ if [ -s "/etc/redhat-release" ];then SYS_VERSION=$(cat /etc/redhat-release) elif [ -s "/etc/issue" ]; then SYS_VERSION=$(cat /etc/issue) fi SYS_INFO=$(uname -a) SYS_BIT=$(getconf LONG_BIT) MEM_TOTAL=$(free -m|grep Mem|awk '{print $2}') CPU_INFO=$(getconf _NPROCESSORS_ONLN) echo -e ${SYS_VERSION} echo -e Bit:${SYS_BIT} Mem:${MEM_TOTAL}M Core:${CPU_INFO} echo -e ${SYS_INFO} echo -e "请截图以上报错信息发帖至论坛www.bt.cn/bbs求助" } Red_Error(){ echo '================================================='; printf '\033[1;31;40m%b\033[0m\n' "$@"; GetSysInfo exit 1; } Lock_Clear(){ if [ -f "/etc/bt_crack.pl" ];then chattr -R -ia /www chattr -ia /etc/init.d/bt \cp -rpa /www/backup/panel/vhost/* /www/server/panel/vhost/ mv /www/server/panel/BTPanel/__init__.bak /www/server/panel/BTPanel/__init__.py rm -f /etc/bt_crack.pl fi } Install_Check(){ if [ "${INSTALL_FORCE}" ];then return fi echo -e "----------------------------------------------------" echo -e "检查已有其他Web/mysql环境,安装宝塔可能影响现有站点及数据" echo -e "Web/mysql service is alreday installed,Can't install panel" echo -e "----------------------------------------------------" echo -e "已知风险/Enter yes to force installation" read -p "输入yes强制安装: " yes; if [ "$yes" != "yes" ];then echo -e "------------" echo "取消安装" exit; fi INSTALL_FORCE="true" } System_Check(){ MYSQLD_CHECK=$(ps -ef |grep mysqld|grep -v grep|grep -v /www/server/mysql) PHP_CHECK=$(ps -ef|grep php-fpm|grep master|grep -v /www/server/php) NGINX_CHECK=$(ps -ef|grep nginx|grep master|grep -v /www/server/nginx) HTTPD_CHECK=$(ps -ef |grep -E 'httpd|apache'|grep -v /www/server/apache|grep -v grep) if [ "${PHP_CHECK}" ] || [ "${MYSQLD_CHECK}" ] || [ "${NGINX_CHECK}" ] || [ "${HTTPD_CHECK}" ];then Install_Check fi } Get_Pack_Manager(){ if [ -f "/usr/bin/yum" ] && [ -d "/etc/yum.repos.d" ]; then PM="yum" elif [ -f "/usr/bin/apt-get" ] && [ -f "/usr/bin/dpkg" ]; then PM="apt-get" fi } Auto_Swap() { swap=$(free |grep Swap|awk '{print $2}') if [ "${swap}" -gt 1 ];then echo "Swap total sizse: $swap"; return; fi if [ ! -d /www ];then mkdir /www fi swapFile="/www/swap" dd if=/dev/zero of=$swapFile bs=1M count=1025 mkswap -f $swapFile swapon $swapFile echo "$swapFile swap swap defaults 0 0" >> /etc/fstab swap=`free |grep Swap|awk '{print $2}'` if [ $swap -gt 1 ];then echo "Swap total sizse: $swap"; return; fi sed -i "/\/www\/swap/d" /etc/fstab rm -f $swapFile } Service_Add(){ if [ "${PM}" == "yum" ] || [ "${PM}" == "dnf" ]; then chkconfig --add bt chkconfig --level 2345 bt on elif [ "${PM}" == "apt-get" ]; then update-rc.d bt defaults fi } get_node_url(){ if [ ! -f /bin/curl ];then if [ "${PM}" = "yum" ]; then yum install curl -y elif [ "${PM}" = "apt-get" ]; then apt-get install curl -y fi fi if [ -f "/www/node.pl" ];then download_Url=$(cat /www/node.pl) echo "Download node: $download_Url"; echo '---------------------------------------------'; return fi echo '---------------------------------------------'; echo "Selected download node..."; nodes=(http://dg2.bt.cn http://dg1.bt.cn http://125.90.93.52:5880 http://36.133.1.8:5880 http://123.129.198.197 http://38.34.185.130 http://116.213.43.206:5880 http://128.1.164.196); tmp_file1=/dev/shm/net_test1.pl tmp_file2=/dev/shm/net_test2.pl [ -f "${tmp_file1}" ] && rm -f ${tmp_file1} [ -f "${tmp_file2}" ] && rm -f ${tmp_file2} touch $tmp_file1 touch $tmp_file2 for node in ${nodes[@]}; do NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${node}/net_test|xargs) RES=$(echo ${NODE_CHECK}|awk '{print $1}') NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $2}') TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $3 * 1000 - 500 }'|cut -d '.' -f 1) if [ "${NODE_STATUS}" == "200" ];then if [ $TIME_TOTAL -lt 100 ];then if [ $RES -ge 1500 ];then echo "$RES $node" >> $tmp_file1 fi else if [ $RES -ge 1500 ];then echo "$TIME_TOTAL $node" >> $tmp_file2 fi fi i=$(($i+1)) if [ $TIME_TOTAL -lt 100 ];then if [ $RES -ge 3000 ];then break; fi fi fi done NODE_URL=$(cat $tmp_file1|sort -r -g -t " " -k 1|head -n 1|awk '{print $2}') if [ -z "$NODE_URL" ];then NODE_URL=$(cat $tmp_file2|sort -g -t " " -k 1|head -n 1|awk '{print $2}') if [ -z "$NODE_URL" ];then NODE_URL='http://download.bt.cn'; fi fi rm -f $tmp_file1 rm -f $tmp_file2 download_Url=$NODE_URL echo "Download node: $download_Url"; echo '---------------------------------------------'; } Remove_Package(){ local PackageNmae=$1 if [ "${PM}" == "yum" ];then isPackage=$(rpm -q ${PackageNmae}|grep "not installed") if [ -z "${isPackage}" ];then yum remove ${PackageNmae} -y fi elif [ "${PM}" == "apt-get" ];then isPackage=$(dpkg -l|grep ${PackageNmae}) if [ "${PackageNmae}" ];then apt-get remove ${PackageNmae} -y fi fi } Install_RPM_Pack(){ yumPath=/etc/yum.conf Centos8Check=$(cat /etc/redhat-release | grep ' 8.' | grep -iE 'centos|Red Hat') isExc=$(cat $yumPath|grep httpd) if [ "$isExc" = "" ];then echo "exclude=httpd nginx php mysql mairadb python-psutil python2-psutil" >> $yumPath fi #SYS_TYPE=$(uname -a|grep x86_64) #yumBaseUrl=$(cat /etc/yum.repos.d/CentOS-Base.repo|grep baseurl=http|cut -d '=' -f 2|cut -d '$' -f 1|head -n 1) #[ "${yumBaseUrl}" ] && checkYumRepo=$(curl --connect-timeout 5 --head -s -o /dev/null -w %{http_code} ${yumBaseUrl}) #if [ "${checkYumRepo}" != "200" ] && [ "${SYS_TYPE}" ];then # curl -Ss --connect-timeout 3 -m 60 http://download.bt.cn/install/yumRepo_select.sh|bash #fi #尝试同步时间(从bt.cn) echo 'Synchronizing system time...' getBtTime=$(curl -sS --connect-timeout 3 -m 60 http://www.bt.cn/api/index/get_time) if [ "${getBtTime}" ];then date -s "$(date -d @$getBtTime +"%Y-%m-%d %H:%M:%S")" fi if [ -z "${Centos8Check}" ]; then yum install ntp -y rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #尝试同步国际时间(从ntp服务器) ntpdate 0.asia.pool.ntp.org setenforce 0 fi startTime=`date +%s` sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config #yum remove -y python-requests python3-requests python-greenlet python3-greenlet yumPacks="libcurl-devel wget tar gcc make zip unzip openssl openssl-devel gcc libxml2 libxml2-devel libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs icu libicu-devel c-ares libffi-devel bzip2-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel" yum install -y ${yumPacks} for yumPack in ${yumPacks} do rpmPack=$(rpm -q ${yumPack}) packCheck=$(echo ${rpmPack}|grep not) if [ "${packCheck}" ]; then yum install ${yumPack} -y fi done if [ -f "/usr/bin/dnf" ]; then dnf install -y redhat-rpm-config fi ALI_OS=$(cat /etc/redhat-release |grep "Alibaba Cloud Linux release 3") if [ -z "${ALI_OS}" ];then yum install epel-release -y fi } Install_Deb_Pack(){ ln -sf bash /bin/sh apt-get update -y apt-get install ruby -y apt-get install lsb-release -y #apt-get install ntp ntpdate -y #/etc/init.d/ntp stop #update-rc.d ntp remove #cat >>~/.profile<<EOF #TZ='Asia/Shanghai'; export TZ #EOF #rm -rf /etc/localtime #cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #echo 'Synchronizing system time...' #ntpdate 0.asia.pool.ntp.org #apt-get upgrade -y debPacks="wget curl libcurl4-openssl-dev gcc make zip unzip tar openssl libssl-dev gcc libxml2 libxml2-dev zlib1g zlib1g-dev libjpeg-dev libpng-dev lsof libpcre3 libpcre3-dev cron net-tools swig build-essential libffi-dev libbz2-dev libncurses-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libdb++-dev libpcap-dev xz-utils git"; apt-get install -y $debPacks --force-yes for debPack in ${debPacks} do packCheck=$(dpkg -l ${debPack}) if [ "$?" -ne "0" ] ;then apt-get install -y $debPack fi done if [ ! -d '/etc/letsencrypt' ];then mkdir -p /etc/letsencryp mkdir -p /var/spool/cron if [ ! -f '/var/spool/cron/crontabs/root' ];then echo '' > /var/spool/cron/crontabs/root chmod 600 /var/spool/cron/crontabs/root fi fi } Get_Versions(){ redhat_version_file="/etc/redhat-release" deb_version_file="/etc/issue" if [ -f $redhat_version_file ];then os_type='el' is_aliyunos=$(cat $redhat_version_file|grep Aliyun) if [ "$is_aliyunos" != "" ];then return fi os_version=$(cat $redhat_version_file|grep CentOS|grep -Eo '([0-9]+\.)+[0-9]+'|grep -Eo '^[0-9]') if [ "${os_version}" = "5" ];then os_version="" fi if [ -z "${os_version}" ];then os_version=$(cat /etc/redhat-release |grep Stream|grep -oE 8) fi else os_type='ubuntu' os_version=$(cat $deb_version_file|grep Ubuntu|grep -Eo '([0-9]+\.)+[0-9]+'|grep -Eo '^[0-9]+') if [ "${os_version}" = "" ];then os_type='debian' os_version=$(cat $deb_version_file|grep Debian|grep -Eo '([0-9]+\.)+[0-9]+'|grep -Eo '[0-9]+') if [ "${os_version}" = "" ];then os_version=$(cat $deb_version_file|grep Debian|grep -Eo '[0-9]+') fi if [ "${os_version}" = "8" ];then os_version="" fi if [ "${is64bit}" = '32' ];then os_version="" fi else if [ "$os_version" = "14" ];then os_version="" fi if [ "$os_version" = "12" ];then os_version="" fi if [ "$os_version" = "19" ];then os_version="" fi if [ "$os_version" = "21" ];then os_version="" fi if [ "$os_version" = "20" ];then os_version2004=$(cat /etc/issue|grep 20.04) if [ -z "${os_version2004}" ];then os_version="" fi fi fi fi } Install_Python_Lib(){ curl -Ss --connect-timeout 3 -m 60 $download_Url/install/pip_select.sh|bash pyenv_path="/www/server/panel" if [ -f $pyenv_path/pyenv/bin/python ];then is_ssl=$($python_bin -c "import ssl" 2>&1|grep cannot) $pyenv_path/pyenv/bin/python3.7 -V if [ $? -eq 0 ] && [ -z "${is_ssl}" ];then chmod -R 700 $pyenv_path/pyenv/bin is_package=$($python_bin -m psutil 2>&1|grep package) if [ "$is_package" = "" ];then wget -O $pyenv_path/pyenv/pip.txt $download_Url/install/pyenv/pip.txt -T 5 $pyenv_path/pyenv/bin/pip install -U pip $pyenv_path/pyenv/bin/pip install -U setuptools $pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt fi source $pyenv_path/pyenv/bin/activate return else rm -rf $pyenv_path/pyenv fi fi is_loongarch64=$(uname -a|grep loongarch64) if [ "$is_loongarch64" != "" ] && [ -f "/usr/bin/yum" ];then yumPacks="python3-devel python3-pip python3-psutil python3-gevent python3-pyOpenSSL python3-paramiko python3-flask python3-rsa python3-requests python3-six python3-websocket-client" yum install -y ${yumPacks} for yumPack in ${yumPacks} do rpmPack=$(rpm -q ${yumPack}) packCheck=$(echo ${rpmPack}|grep not) if [ "${packCheck}" ]; then yum install ${yumPack} -y fi done pip3 install -U pip pip3 install Pillow psutil pyinotify pycryptodome upyun oss2 pymysql qrcode qiniu redis pymongo Cython configparser cos-python-sdk-v5 supervisor gevent-websocket pyopenssl pip3 install flask==1.1.4 pip3 install Pillow -U pyenv_bin=/www/server/panel/pyenv/bin mkdir -p $pyenv_bin ln -sf /usr/local/bin/pip3 $pyenv_bin/pip ln -sf /usr/local/bin/pip3 $pyenv_bin/pip3 ln -sf /usr/local/bin/pip3 $pyenv_bin/pip3.7 if [ -f "/usr/bin/python3.7" ];then ln -sf /usr/bin/python3.7 $pyenv_bin/python ln -sf /usr/bin/python3.7 $pyenv_bin/python3 ln -sf /usr/bin/python3.7 $pyenv_bin/python3.7 elif [ -f "/usr/bin/python3.6" ]; then ln -sf /usr/bin/python3.6 $pyenv_bin/python ln -sf /usr/bin/python3.6 $pyenv_bin/python3 ln -sf /usr/bin/python3.6 $pyenv_bin/python3.7 fi echo > $pyenv_bin/activate return fi py_version="3.7.8" mkdir -p $pyenv_path echo "True" > /www/disk.pl if [ ! -w /www/disk.pl ];then Red_Error "ERROR: Install python env fielded." "ERROR: /www目录无法写入,请检查目录/用户/磁盘权限!" fi os_type='el' os_version='7' is_export_openssl=0 Get_Versions echo "OS: $os_type - $os_version" is_aarch64=$(uname -a|grep aarch64) if [ "$is_aarch64" != "" ];then is64bit="aarch64" fi if [ -f "/www/server/panel/pymake.pl" ];then os_version="" rm -f /www/server/panel/pymake.pl fi if [ "${os_version}" != "" ];then pyenv_file="/www/pyenv.tar.gz" wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 10 tmp_size=$(du -b $pyenv_file|awk '{print $1}') if [ $tmp_size -lt 703460 ];then rm -f $pyenv_file echo "ERROR: Download python env fielded." else echo "Install python env..." tar zxvf $pyenv_file -C $pyenv_path/ > /dev/null chmod -R 700 $pyenv_path/pyenv/bin if [ ! -f $pyenv_path/pyenv/bin/python ];then rm -f $pyenv_file Red_Error "ERROR: Install python env fielded." "ERROR: 下载宝塔运行环境失败,请尝试重新安装!" fi $pyenv_path/pyenv/bin/python3.7 -V if [ $? -eq 0 ];then rm -f $pyenv_file ln -sf $pyenv_path/pyenv/bin/pip3.7 /usr/bin/btpip ln -sf $pyenv_path/pyenv/bin/python3.7 /usr/bin/btpython source $pyenv_path/pyenv/bin/activate return else rm -f $pyenv_file rm -rf $pyenv_path/pyenv fi fi fi cd /www python_src='/www/python_src.tar.xz' python_src_path="/www/Python-${py_version}" wget -O $python_src $download_Url/src/Python-${py_version}.tar.xz -T 5 tmp_size=$(du -b $python_src|awk '{print $1}') if [ $tmp_size -lt 10703460 ];then rm -f $python_src Red_Error "ERROR: Download python source code fielded." "ERROR: 下载宝塔运行环境失败,请尝试重新安装!" fi tar xvf $python_src rm -f $python_src cd $python_src_path ./configure --prefix=$pyenv_path/pyenv make -j$cpu_cpunt make install if [ ! -f $pyenv_path/pyenv/bin/python3.7 ];then rm -rf $python_src_path Red_Error "ERROR: Make python env fielded." "ERROR: 编译宝塔运行环境失败!" fi cd ~ rm -rf $python_src_path wget -O $pyenv_path/pyenv/bin/activate $download_Url/install/pyenv/activate.panel -T 5 wget -O $pyenv_path/pyenv/pip.txt $download_Url/install/pyenv/pip-3.7.8.txt -T 5 ln -sf $pyenv_path/pyenv/bin/pip3.7 $pyenv_path/pyenv/bin/pip ln -sf $pyenv_path/pyenv/bin/python3.7 $pyenv_path/pyenv/bin/python ln -sf $pyenv_path/pyenv/bin/pip3.7 /usr/bin/btpip ln -sf $pyenv_path/pyenv/bin/python3.7 /usr/bin/btpython chmod -R 700 $pyenv_path/pyenv/bin $pyenv_path/pyenv/bin/pip install -U pip $pyenv_path/pyenv/bin/pip install -U setuptools $pyenv_path/pyenv/bin/pip install -U wheel==0.34.2 $pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt source $pyenv_path/pyenv/bin/activate is_gevent=$($python_bin -m gevent 2>&1|grep -oE package) is_psutil=$($python_bin -m psutil 2>&1|grep -oE package) if [ "${is_gevent}" != "${is_psutil}" ];then Red_Error "ERROR: psutil/gevent install failed!" fi } Install_Bt(){ panelPort="8888" if [ -f ${setup_path}/server/panel/data/port.pl ];then panelPort=$(cat ${setup_path}/server/panel/data/port.pl) fi mkdir -p ${setup_path}/server/panel/logs mkdir -p ${setup_path}/server/panel/vhost/apache mkdir -p ${setup_path}/server/panel/vhost/nginx mkdir -p ${setup_path}/server/panel/vhost/rewrite mkdir -p ${setup_path}/server/panel/install mkdir -p /www/server mkdir -p /www/wwwroot mkdir -p /www/wwwlogs mkdir -p /www/backup/database mkdir -p /www/backup/site if [ -f "/etc/init.d/bt" ]; then /etc/init.d/bt stop sleep 1 fi wget -O /etc/init.d/bt ${download_Url}/install/src/bt6.init -T 10 wget -O /www/server/panel/install/public.sh ${download_Url}/install/public.sh -T 10 wget -O panel.zip ${download_Url}/install/src/panel6.zip -T 10 if [ -f "${setup_path}/server/panel/data/default.db" ];then if [ -d "/${setup_path}/server/panel/old_data" ];then rm -rf ${setup_path}/server/panel/old_data fi mkdir -p ${setup_path}/server/panel/old_data d_format=$(date +"%Y%m%d_%H%M%S") \cp -arf ${setup_path}/server/panel/data/default.db ${setup_path}/server/panel/data/default_backup_${d_format}.db mv -f ${setup_path}/server/panel/data/default.db ${setup_path}/server/panel/old_data/default.db mv -f ${setup_path}/server/panel/data/system.db ${setup_path}/server/panel/old_data/system.db mv -f ${setup_path}/server/panel/data/port.pl ${setup_path}/server/panel/old_data/port.pl mv -f ${setup_path}/server/panel/data/admin_path.pl ${setup_path}/server/panel/old_data/admin_path.pl fi if [ ! -f "/usr/bin/unzip" ]; then if [ "${PM}" = "yum" ]; then yum install unzip -y elif [ "${PM}" = "apt-get" ]; then apt-get update apt-get install unzip -y fi fi unzip -o panel.zip -d ${setup_path}/server/ > /dev/null if [ -d "${setup_path}/server/panel/old_data" ];then mv -f ${setup_path}/server/panel/old_data/default.db ${setup_path}/server/panel/data/default.db mv -f ${setup_path}/server/panel/old_data/system.db ${setup_path}/server/panel/data/system.db mv -f ${setup_path}/server/panel/old_data/port.pl ${setup_path}/server/panel/data/port.pl mv -f ${setup_path}/server/panel/old_data/admin_path.pl ${setup_path}/server/panel/data/admin_path.pl if [ -d "/${setup_path}/server/panel/old_data" ];then rm -rf ${setup_path}/server/panel/old_data fi fi if [ ! -f ${setup_path}/server/panel/tools.py ] || [ ! -f ${setup_path}/server/panel/BT-Panel ];then ls -lh panel.zip Red_Error "ERROR: Failed to download, please try install again!" "ERROR: 下载宝塔失败,请尝试重新安装!" fi rm -f panel.zip rm -f ${setup_path}/server/panel/class/*.pyc rm -f ${setup_path}/server/panel/*.pyc chmod +x /etc/init.d/bt chmod -R 600 ${setup_path}/server/panel chmod -R +x ${setup_path}/server/panel/script ln -sf /etc/init.d/bt /usr/bin/bt echo "${panelPort}" > ${setup_path}/server/panel/data/port.pl wget -O /etc/init.d/bt ${download_Url}/install/src/bt7.init -T 10 wget -O /www/server/panel/init.sh ${download_Url}/install/src/bt7.init -T 10 wget -O /www/server/panel/data/softList.conf ${download_Url}/install/conf/softList.conf } Set_Bt_Panel(){ Run_User="www" wwwUser=$(cat /etc/passwd|grep www) if [ "${wwwUser}" == "" ];then groupadd ${Run_User} useradd -s /sbin/nologin -g ${Run_User} ${Run_User} fi password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8) sleep 1 admin_auth="/www/server/panel/data/admin_path.pl" if [ ! -f ${admin_auth} ];then auth_path=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8) echo "/${auth_path}" > ${admin_auth} fi auth_path=$(cat ${admin_auth}) cd ${setup_path}/server/panel/ /etc/init.d/bt start $python_bin -m py_compile tools.py $python_bin tools.py username username=$($python_bin tools.py panel ${password}) cd ~ echo "${password}" > ${setup_path}/server/panel/default.pl chmod 600 ${setup_path}/server/panel/default.pl sleep 3 /etc/init.d/bt restart sleep 3 isStart=$(ps aux |grep 'BT-Panel'|grep -v grep|awk '{print $2}') LOCAL_CURL=$(curl 127.0.0.1:8888/login 2>&1 |grep -i html) if [ -z "${isStart}" ] && [ -z "${LOCAL_CURL}" ];then /etc/init.d/bt 22 cd /www/server/panel/pyenv/bin touch t.pl ls -al python3.7 python lsattr python3.7 python Red_Error "ERROR: The BT-Panel service startup failed." "ERROR: 宝塔启动失败" fi } Set_Firewall(){ sshPort=$(cat /etc/ssh/sshd_config | grep 'Port '|awk '{print $2}') if [ "${PM}" = "apt-get" ]; then apt-get install -y ufw if [ -f "/usr/sbin/ufw" ];then ufw allow 20/tcp ufw allow 21/tcp ufw allow 22/tcp ufw allow 80/tcp ufw allow 888/tcp ufw allow ${panelPort}/tcp ufw allow ${sshPort}/tcp ufw allow 39000:40000/tcp ufw_status=`ufw status` echo y|ufw enable ufw default deny ufw reload fi else if [ -f "/etc/init.d/iptables" ];then iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 20 -j ACCEPT iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport ${panelPort} -j ACCEPT iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport ${sshPort} -j ACCEPT iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 39000:40000 -j ACCEPT #iptables -I INPUT -p tcp -m state --state NEW -m udp --dport 39000:40000 -j ACCEPT iptables -A INPUT -p icmp --icmp-type any -j ACCEPT iptables -A INPUT -s localhost -d localhost -j ACCEPT iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -P INPUT DROP service iptables save sed -i "s#IPTABLES_MODULES=\"\"#IPTABLES_MODULES=\"ip_conntrack_netbios_ns ip_conntrack_ftp ip_nat_ftp\"#" /etc/sysconfig/iptables-config iptables_status=$(service iptables status | grep 'not running') if [ "${iptables_status}" == '' ];then service iptables restart fi else AliyunCheck=$(cat /etc/redhat-release|grep "Aliyun Linux") [ "${AliyunCheck}" ] && return yum install firewalld -y [ "${Centos8Check}" ] && yum reinstall python3-six -y systemctl enable firewalld systemctl start firewalld firewall-cmd --set-default-zone=public > /dev/null 2>&1 firewall-cmd --permanent --zone=public --add-port=20/tcp > /dev/null 2>&1 firewall-cmd --permanent --zone=public --add-port=21/tcp > /dev/null 2>&1 firewall-cmd --permanent --zone=public --add-port=22/tcp > /dev/null 2>&1 firewall-cmd --permanent --zone=public --add-port=80/tcp > /dev/null 2>&1 firewall-cmd --permanent --zone=public --add-port=${panelPort}/tcp > /dev/null 2>&1 firewall-cmd --permanent --zone=public --add-port=${sshPort}/tcp > /dev/null 2>&1 firewall-cmd --permanent --zone=public --add-port=39000-40000/tcp > /dev/null 2>&1 #firewall-cmd --permanent --zone=public --add-port=39000-40000/udp > /dev/null 2>&1 firewall-cmd --reload fi fi } Get_Ip_Address(){ getIpAddress="" getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress) if [ -z "${getIpAddress}" ] || [ "${getIpAddress}" = "0.0.0.0" ]; then isHosts=$(cat /etc/hosts|grep 'www.bt.cn') if [ -z "${isHosts}" ];then echo "" >> /etc/hosts echo "116.213.43.206 www.bt.cn" >> /etc/hosts getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress) if [ -z "${getIpAddress}" ];then sed -i "/bt.cn/d" /etc/hosts fi fi fi ipv4Check=$($python_bin -c "import re; print(re.match('^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$','${getIpAddress}'))") if [ "${ipv4Check}" == "None" ];then ipv6Address=$(echo ${getIpAddress}|tr -d "[]") ipv6Check=$($python_bin -c "import re; print(re.match('^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$','${ipv6Address}'))") if [ "${ipv6Check}" == "None" ]; then getIpAddress="SERVER_IP" else echo "True" > ${setup_path}/server/panel/data/ipv6.pl sleep 1 /etc/init.d/bt restart fi fi if [ "${getIpAddress}" != "SERVER_IP" ];then echo "${getIpAddress}" > ${setup_path}/server/panel/data/iplist.txt fi LOCAL_IP=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1) } Setup_Count(){ curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/SetupCount?type=Linux\&o=$1 > /dev/null 2>&1 if [ "$1" != "" ];then echo $1 > /www/server/panel/data/o.pl cd /www/server/panel $python_bin tools.py o fi echo /www > /var/bt_setupPath.conf } Install_Main(){ startTime=`date +%s` Lock_Clear System_Check Get_Pack_Manager get_node_url MEM_TOTAL=$(free -g|grep Mem|awk '{print $2}') if [ "${MEM_TOTAL}" -le "1" ];then Auto_Swap fi if [ "${PM}" = "yum" ]; then Install_RPM_Pack elif [ "${PM}" = "apt-get" ]; then Install_Deb_Pack fi Install_Python_Lib Install_Bt Set_Bt_Panel Service_Add Set_Firewall Get_Ip_Address Setup_Count ${IDC_CODE} } echo " +---------------------------------------------------------------------- | Bt-WebPanel FOR CentOS/Ubuntu/Debian +---------------------------------------------------------------------- | Copyright © 2015-2099 BT-SOFT(http://www.bt.cn) All rights reserved. +---------------------------------------------------------------------- | The WebPanel URL will be http://SERVER_IP:8888 when installed. +---------------------------------------------------------------------- " while [ "$go" != 'y' ] && [ "$go" != 'n' ] do read -p "Do you want to install Bt-Panel to the $setup_path directory now?(y/n): " go; done if [ "$go" == 'n' ];then exit; fi Install_Main echo > /www/server/panel/data/bind.pl echo -e "==================================================================" echo -e "\033[32mCongratulations! Installed successfully!\033[0m" echo -e "==================================================================" echo "外网面板地址: http://${getIpAddress}:${panelPort}${auth_path}" echo "内网面板地址: http://${LOCAL_IP}:${panelPort}${auth_path}" echo -e "username: $username" echo -e "password: $password" echo -e "\033[33mIf you cannot access the panel,\033[0m" echo -e "\033[33mrelease the following panel port [${panelPort}] in the security group\033[0m" echo -e "\033[33m若无法访问面板,请检查防火墙/安全组是否有放行面板[${panelPort}]端口\033[0m" echo -e "==================================================================" endTime=`date +%s` ((outTime=($endTime-$startTime)/60)) echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
2022年06月09日
178 阅读
0 评论
0 点赞
2022-06-09
调整路由器网络后,虚拟机ubuntu连不上网络问题
由于访问某些科学网站的需要,需要调整移动直连光猫的路由器。改为光猫直连交换机,再连路由器。实际上网络状态并没有变得更好,因为移动宽带没用电信宽带好用。调整后没想到出现了意想不到的问题。调整路由器网络后,虚拟机ubuntu连不上网络问题尝试了命令 dhclient / dhclient ens33 / ifoncif ens33 up 等等都无效使用 ifconfig 也能看到网卡 ens33 和mac地址,重启n次也无效以为是路由器之前绑定过静态mac,重新生成mac还是无效折腾了半天,最后竟然发现是这样的原因需要为虚拟机指定网卡硬件
2022年06月09日
116 阅读
0 评论
0 点赞
2022-06-07
linux下添加用户到docker组
1.添加docker用户组sudo groupadd docker2.将当前用户添加至docker用户组sudo gpasswd -a $USER docker3.更新docker用户组newgrp docker
2022年06月07日
187 阅读
0 评论
0 点赞
1
...
4
5
6
...
11
您的IP: