Skip to content

Commit e097755

Browse files
committed
Add quick setup md
1 parent 01248af commit e097755

File tree

1 file changed

+188
-0
lines changed

1 file changed

+188
-0
lines changed

quick-setup.md

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# Network
2+
nmcli con show
3+
4+
## Headnode
5+
6+
### etho
7+
sudo nmcli con modify "Wired connection 1" ipv4.method manual ipv4.addresses 192.168.1.10/24 ipv4.gateway "" ipv4.dns "8.8.8.8"
8+
9+
sudo nmcli con down "Wired connection 1"
10+
sudo nmcli con up "Wired connection 1"
11+
ip addr show eth0
12+
13+
### wifi
14+
nmcli con show "preconfigured"
15+
16+
sudo nmcli con modify "preconfigured" ipv4.method auto
17+
sudo nmcli con down "preconfigured"
18+
sudo nmcli con up "preconfigured"
19+
20+
## Children nodes
21+
nmcli con show
22+
23+
### eth
24+
(update 192.168.1.1x)
25+
hs - 0
26+
01 - 1
27+
02 - 2
28+
03 - 3
29+
04 - 4
30+
ai - 5
31+
sudo nmcli con modify "Wired connection 1" ipv4.method manual ipv4.addresses 192.168.1.15/24 ipv4.gateway 192.168.1.10 ipv4.dns "192.168.1.10 8.8.8.8"
32+
33+
sudo nmcli con down "Wired connection 1"
34+
sudo nmcli con up "Wired connection 1"
35+
36+
ip addr show eth0
37+
38+
## host file
39+
sudo nano /etc/hosts
40+
41+
192.168.1.10 hs001
42+
192.168.1.11 pi001
43+
192.168.1.12 pi002
44+
192.168.1.13 pi003
45+
192.168.1.14 pi004
46+
192.168.1.15 ai001
47+
48+
## NAT
49+
### headnode
50+
sudo nano /etc/sysctl.conf
51+
52+
sudo sysctl -p
53+
54+
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
55+
56+
sudo iptables -t nat -L
57+
58+
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
59+
60+
sudo iptables-restore < /etc/iptables.ipv4.nat
61+
62+
sudo nano /etc/rc.local
63+
64+
## Test
65+
ping -c 4 hs001
66+
ping -c 4 pi003
67+
ping -c 4 ai001
68+
69+
## Disable wifi
70+
(on children nodes)
71+
nmcli con show
72+
73+
sudo nmcli con modify "preconfigured" connection.autoconnect no
74+
sudo nmcli radio wifi off
75+
76+
# FRP
77+
headnode
78+
79+
mkdir && cd system_setting
80+
wget https://github.com/fatedier/frp/releases/download/v0.61.2/frp_0.61.2_linux_arm64.tar.gz
81+
tar -zxvf frp_0.61.2_linux_arm64.tar.gz
82+
83+
cd frp_0.61.2_linux_arm64
84+
nano frpc.toml
85+
86+
### systemd
87+
sudo nano /etc/systemd/system/frpc.service
88+
89+
[Unit]
90+
Description=FRP Client Service
91+
After=network.target
92+
93+
[Service]
94+
Type=simple
95+
User=yuwei
96+
WorkingDirectory=/home/yuwei/system_setting/frp_0.61.2_linux_arm64
97+
ExecStart=/home/yuwei/system_setting/frp_0.61.2_linux_arm64/frpc -c /home/yuwei/system_setting/frp_0.61.2_linux_arm64/frpc.toml
98+
Restart=on-failure
99+
100+
[Install]
101+
WantedBy=multi-user.target
102+
103+
sudo systemctl daemon-reload
104+
105+
sudo systemctl enable frpc
106+
sudo systemctl start frpc
107+
108+
109+
# SSH
110+
111+
## macbook to headnode
112+
After generate ssh key on macbook
113+
114+
ssh-copy-id -i ~/.ssh/id_rsa.pub yuwei@hs001.local
115+
116+
## node to node
117+
ssh-keygen -t rsa -b 4096 -C "ys4680@nyu.edu"
118+
119+
ssh-copy-id yuwei@pi001
120+
ssh-copy-id yuwei@pi002
121+
ssh-copy-id yuwei@pi003
122+
ssh-copy-id yuwei@pi004
123+
ssh-copy-id yuwei@ai001
124+
ssh-copy-id yuwei@hs001
125+
126+
# NFS
127+
(headnode)
128+
129+
### Mount
130+
df -h
131+
lsblk
132+
sudo mkfs.ext4 /dev/sda1 -L SSDDATA
133+
134+
sudo mkdir -p /mnt/ssd
135+
sudo mount /dev/sda1 /mnt/ssd
136+
137+
df -h | grep /mnt/ssd
138+
139+
sudo blkid /dev/sda1
140+
141+
sudo nano /etc/fstab
142+
add: UUID=bebf3676-e2e2-45b2-bf67-99fc836b243c /mnt/ssd ext4 defaults 0 2
143+
144+
### Install NFS
145+
sudo apt-get update
146+
sudo apt-get install nfs-kernel-server
147+
148+
sudo chown -R nobody:nogroup /mnt/ssd
149+
sudo chmod 777 /mnt/ssd
150+
151+
sudo nano /etc/exports
152+
add: /mnt/ssd 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)
153+
154+
sudo exportfs -a
155+
sudo systemctl restart nfs-kernel-server
156+
157+
### NFS common
158+
(on each children node)
159+
160+
sudo apt install -y nfs-common
161+
sudo mkdir -p /mnt/sharedssd
162+
sudo mount 192.168.1.10:/mnt/ssd /mnt/sharedssd
163+
164+
# Tool
165+
166+
run_everywhere.sh
167+
./run_everywhere.sh 'sudo apt update && sudo apt install -y htop'
168+
169+
# MPI
170+
(all nodes)
171+
172+
./rrun_everywhere.sh 'sudo apt install -y openmpi-bin openmpi-common libopenmpi-dev'
173+
174+
nano ~/mpi_hosts
175+
hs001 slots=4
176+
pi001 slots=4
177+
pi002 slots=4
178+
pi003 slots=4
179+
pi004 slots=4
180+
ai001 slots=4
181+
182+
mpicc hello.c -o hello
183+
mpirun -np 6 --hostfile ~/mpi_hosts ./hello
184+
185+
mv ~/mpi_hosts ~/sharedssd/mpi_hosts
186+
./run_everywhere.sh "echo '# Set default MPI hostfile' >> ~/.bashrc && echo 'export OMPI_MCA_orte_default_hostfile=~/sharedssd/mpi_hosts' >> ~/.bashrc"
187+
188+
mpirun -np 24 ./hello

0 commit comments

Comments
 (0)