-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-install.sh
86 lines (69 loc) · 2.8 KB
/
init-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
function centos_install_docker(){
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum makecache fast
sudo yum -y install docker-ce
sudo service docker start
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | \
sudo tee /etc/yum.repos.d/nvidia-docker.repo
DIST=$(sed -n 's/releasever=//p' /etc/yum.conf)
DIST=${DIST:-$(. /etc/os-release; echo $VERSION_ID)}
sudo yum makecache
sudo yum install -y nvidia-docker2
sudo systemctl restart docker
}
function ubuntu_install_docker(){
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get -y update
sudo apt-get -y install docker-ce
sudo apt install nfs-kernel-server nfs-common lrzsz telnet iftop python3-pip htop tree -y
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
curl -s -L https://nvidia.github.io/nvidia-container-runtime/experimental/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
}
function mkdisk(){
# parted /dev/vdb mklabel gpt
# parted /dev/vdb mkpart primary 0 20G
# parted /dev/vdb p
# mkfs -t ext4 /dev/sdb1
# pvcreate /dev/sdb1
# vgcreate vg1-zach /dev/sdb1
# lvcreate -L 2000G -n lv1-zach vg1-zach
# mkfs.ext4 /dev/vg1-zach/lv1-zach
# blkid /dev/vg1-zach/lv1-zach
parted /dev/$1 mklabel gpt
parted /dev/$1 mkpart primary 0 537G
parted /dev/$1 p
pvcreate /dev/$11
vgcreate vg-$1-zach /dev/$11
lvcreate -L 537G -n $1-lv-zach vg-$1-zach
mkfs.ext4 /dev/vg-$1-zach/$1-lv-zach
blkid /dev/vg-$1-zach/$1-lv-zach
}
function resize_disk(){
current_disk=`parted /dev/vdb p | grep "Disk /dev/vdb:" | awk '{print $NF}'`
parted /dev/vdc resizepart 1 $current_disk
partprobe
pvresize /dev/vdc1
pvscan
lvextend -L +150g /dev/vg2-zach/lv2-zach
resize2fs /dev/vg2-zach/lv2-zach
}
function sftp_split(){
cat >> /etc/ssh/sshd_config << EOF
Subsystem sftp internal-sftp
Match User web
ChrootDirectory %h
ForceCommand internal-sftp
EOF
adduser --home /media/data/zach-blobdata-upload/front-page --shell /bin/false web
chown root.root /media/data/zach-blobdata-upload/
}