Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
tingweiwang
/
machine-init
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 985e3c77
authored
Jan 07, 2020
by
wangtingwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hello world
0 parents
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
init.sh
init.sh
0 → 100644
View file @
985e3c7
#!/bin/bash
#王庭威
#2020/1/7
local_ip
=
192.168.137.200
disk
=
##################################################不常改变的变量####################
repo_ip
=
192.168.1.145
repo_host
=
apt.offline.com
end_ip
=
`
echo
$repo_ip
|awk -F
"."
'{print $4}'
`
##################################################基础函数#################################
base
()
{
echo
"##################设置修改内网apt源############################################"
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo
"deb http://
$repo_host
debs/"
>>/etc/apt/sources.list
echo
"
$repo_ip
$repo_host
"
>>/etc/hosts
echo
"更新apt源并且下载最基础软件"
apt update --allow-insecure-repositories
apt install openssh-server vim lrzsz -y --allow-unauthenticated
echo
"####################设置ssh,允许root用户登陆以及设置密码#######################"
sed -i s/prohibit-password/yes/g /etc/ssh/sshd_config
echo
"####################设置root用户密码###############################################"
passwd root
echo
"设置节点dns"
rm -rf /etc/resolv.conf
&&
echo
"nameserver 114.114.114.114"
>>/etc/resolv.conf
}
###########################################################################################
cpu
()
{
base
echo
"#################设置本机主机名#############################################"
hostname seetaas-cpu-
$end_ip
echo
"seetaas-cpu-
$end_ip
"
>>/etc/hostname
echo
"#################设置本机hosts#############################################"
echo
"
$local_ip
seetaas-cpu-
$end_ip
"
>>/etc/hosts
}
gpu
()
{
base
echo
"#################设置本机主机名#############################################"
hostname seetaas-gpu-
$end_ip
echo
"seetaas-gpu-
$end_ip
"
>>/etc/hostname
echo
"#################设置本机hosts#############################################"
echo
"
$local_ip
seetaas-gpu-
$end_ip
"
>>/etc/hosts
}
storage
()
{
base
echo
"#################设置本机主机名#############################################"
hostname seetaas-storage-
$end_ip
echo
"seetaas-storage-
$end_ip
"
>>/etc/hostname
echo
"#################设置本机hosts#############################################"
echo
"
$local_ip
seetaas-storage-
$end_ip
"
>>/etc/hosts
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment