-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
executable file
·153 lines (133 loc) · 6.32 KB
/
README
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash
set -a
[[ ! -f /data/vdc/vdc.env ]] && {
echo "Error : /data/vdc/vdc.env not found"
exit 0
}
. /data/vdc/vdc.env
# network config
echo sudo nmcli c show
echo sudo nmcli d show
# create network config
# VDC_CLUSTER_IDX can go up to 255
VDC_CLUSTER_IDX=${VDC_CLUSTER_IDX:-"29"}
# to add new clusters id, update VDC_CLUSTER_IDX to the target value, and generate the commands
for cid in $(seq 0 $VDC_CLUSTER_IDX)
do
for nid in 0 1 2
do
gw="10.${cid}.${nid}.1"
br="br-${cid}-${nid}"
dum="dum-${cid}-${nid}"
if test "$gw" = "10.0.1.1" -o "$gw" = "10.0.2.1"
then
continue
fi
echo "# $br"
echo sudo nmcli c del bridge-$br
echo sudo nmcli c del dummy-$dum
echo sudo ip link del $dum
echo
echo sudo nmcli c add type dummy ifname $dum con-name dummy-$dum
echo sudo nmcli c mod dummy-$dum ipv4.method disabled
echo sudo nmcli c add type bridge ifname $br con-name bridge-$br
echo sudo nmcli c mod bridge-$br bridge.stp no
echo sudo nmcli c mod dummy-$dum connection.master $br connection.slave-type bridge
echo sudo nmcli c mod bridge-$br ipv4.method manual ipv4.addresses $gw/24
echo sudo nmcli c up bridge-$br
echo sudo nmcli c up dummy-$dum
done
done
# sudo nmcli c add type ethernet ifname enp0s31f6 con-name enp0s31f6
# sudo nmcli c mod enp0s31f6 connection.master br-prd connection.slave-type bridge
# zpool create
echo
echo zpool create -f data /dev/disk/by-id/wwn-0x5000c500a8f5c148
echo zpool add data cache /dev/disk/by-id/nvme-eui.0025385571b178e8-part3
echo zpool add data log /dev/disk/by-id/nvme-eui.0025385571b178e8-part4
echo zfs create data/vdc
echo zfs set canmount=noauto data/vdc
echo mount -t zfs data/vdc /data
echo "cd /data & git clone git+ssh://[email protected]/home/opensvc/vdc"
# libvirt pool create
echo mkdir -p /data/vdc/pool
# repos
echo sudo apt install yum-utils createrepo
# centos7
echo sudo mkdir -p /data/vdc/share/repos/centos/7/{base,centosplus,extras,updates}
echo sudo mkdir -p /data/vdc/share/repos/epel/7
echo sudo mkdir -p /data/vdc/share/repos/elrepo/7
echo cd /data/vdc/share/repos
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=base \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/centos/7/
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=extras \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/centos/7/
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=updates \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/centos/7/
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=epel7 \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/epel/7/
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.7.conf --plugins --repoid=elrepo7 \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/elrepo/7
echo sudo createrepo /data/vdc/share/repos/centos/7/base/ -g comps.xml
echo sudo createrepo /data/vdc/share/repos/centos/7/extras/
echo sudo createrepo /data/vdc/share/repos/centos/7/updates/
echo sudo createrepo /data/vdc/share/repos/epel/7/
echo sudo createrepo /data/vdc/share/repos/elrepo/7/
# centos8 (createrepo not needed)
echo sudo mkdir -p /data/vdc/share/repos/centos/8/{BaseOS,extras,AppStream}
echo sudo mkdir -p /data/vdc/share/repos/epel/8
echo sudo mkdir -p /data/vdc/share/repos/elrepo/8
echo cd /data/vdc/share/repos
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=BaseOS \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/centos/8/
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=extras \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/centos/8/
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=AppStream \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/centos/8/
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=epel \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/epel/8/
echo sudo reposync --config=/data/vdc/share/repos/yum/yum.8.conf --plugins --repoid=elrepo8 \
--newest-only --delete --downloadcomps --download-metadata \
--download_path=/data/vdc/share/repos/elrepo/8
echo sudo createrepo /data/vdc/share/repos/centos/8/BaseOS/ -g comps.xml
echo sudo createrepo /data/vdc/share/repos/centos/8/extras/
echo sudo createrepo /data/vdc/share/repos/centos/8/AppStream/
echo sudo createrepo /data/vdc/share/repos/epel/8/
echo sudo createrepo /data/vdc/share/repos/elrepo/8/
# provision lab vm
echo cd /data/vdc/build/lab
echo vagrant up --no-parallel
# unprovision lab vm
echo cd /data/vdc/build/lab
echo vagrant destroy
# vagrant/vbox survival guide
# ----------------------
# vagrant up --debug &> vagrant.log
# vboxmanage showvminfo vm-name
# vboxmanage list hdds # liste les disques de la database vagrant
# vboxmanage closemedium disk eb42735a-980c-4da5-9ae4-95c5ff48b1bb --delete # retire un disque de la database vagrant
# vbox upgrade
# ----------------------
# stop all running vms
# apt install ./virtualbox-6.0_6.0.12-133076~Ubuntu~bionic_amd64.deb
# check with vboxmanage --version
# vboxmanage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-6.0.12.vbox-extpack
# openssl latest version build centos7
# sudo yum install libtool perl-core zlib-devel -y
# curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz
# tar xzf OpenSSL_1_1_1c.tar.gz -C /opt
# cd /opt/openssl-OpenSSL_1_1_1c
# ./config --prefix=/opt/openssl --openssldir=/usr/local/ssl
# make && make test && make install
# tar czvf /root/openssl.osvc.tar.gz /opt/openssl /usr/local/ssl
# echo "pathmunge /opt/openssl/bin" > /etc/profile.d/openssl.sh
# echo "/opt/openssl/lib" > /etc/ld.so.conf.d/openssl-1.1.1c.conf && ldconfig -v