Skip to content

Commit 028a4c5

Browse files
committed
Update install.sh for installation issues
1. .ssh directory does not always exist 2. Rename $USERDIR to $SSHDIR 3. Installation should be proceeded under /root
1 parent e640cf3 commit 028a4c5

3 files changed

Lines changed: 47 additions & 27 deletions

File tree

README.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,48 @@ Feature
1111

1212
Build OpenNet on your own - Use install.sh
1313
------------------------------------------
14-
Supports Ubuntu 14.04.1
14+
Supports Ubuntu 14.04.3
1515

16-
$ git clone https://github.com/dlinknctu/OpenNet.git
17-
$ cd OpenNet
18-
$ sudo ./configure.sh
19-
$ sudo ./install.sh master
20-
After a successful installation, the script will show "OpenNet installation complete."
16+
$ sudo su -
17+
# apt-get install git ssh
18+
# git clone https://github.com/dlinknctu/OpenNet.git
19+
# cd OpenNet
20+
# ./configure.sh
21+
# ./install.sh master
22+
23+
After a successful installation, the script will show "OpenNet installation complete."
2124

2225
Run OpenNet
2326
-----------
2427
Before using OpenNet, you need to prepare SDN controller by yourself.
2528
Please try following commands to run the simulation:
2629

27-
$ sudo ./waf_shell.sh
28-
# cd $ROOT_PATH/mininet/examples/opennet
30+
$ sudo su -
31+
# cd OpenNet
32+
# ./waf_shell.sh
33+
# cd ../../mininet/examples/opennet
2934
# python wifiroaming.py
3035

31-
Do not add "sudo" at the head of the third line.
36+
Do not type "sudo python wifiroaming.py", sudo will affect the environment
37+
variable required by simulation.
38+
39+
If the simulation script cannot connect to the controller,
40+
stop the network-manager may help.
41+
42+
# service network-manager stop
43+
44+
Start the network-manager service after the simulation.
45+
46+
# service network-manager start
3247

3348
Run NetAnim
3449
-----------
3550
Use NetAnim to open the XML file in the directory /tmp/xml.
36-
Click "Play Animation" button can start the animation.
51+
Click "Play Animation" button can start the animation.
3752

38-
$ cd $ROOT_PATH/ns-allinone-$NS3_VERSION/netanim-$NETANIM_VERSION
39-
$ ./NetAnim
53+
$ sudo su -
54+
# cd OpenNet/ns-allinone-$NS3_VERSION/netanim-$NETANIM_VERSION
55+
# ./NetAnim
4056

4157
Reference
4258
---------

ansible/roles/apt/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- name: Install required package
1313
apt: name={{ item }} state=present
1414
with_items:
15+
- ssh
1516
- vim
1617
- tmux
1718
- git

install.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44
OPENNET_PATH=$PWD
55
ANSIBLE_PATH=$OPENNET_PATH/ansible
6-
USERDIR=$HOME/.ssh
6+
SSHDIR=$HOME/.ssh
77
user=$(whoami)
88

99
function Install_Ansible {
@@ -19,30 +19,33 @@ function Install_Ansible {
1919

2020
function SSH_Config_Setup {
2121

22-
if [ ! -f $USERDIR/cluster_key.pub ]; then
22+
if [ ! -d $SSHDIR ]; then
23+
mkdir -p $SSHDIR
24+
fi
25+
if [ ! -f $SSHDIR/cluster_key.pub ]; then
2326
echo "***creating key pair"
24-
ssh-keygen -t rsa -C "Cluster_Edition_Key" -f $USERDIR/cluster_key -N '' &> /dev/null
25-
cat $USERDIR/cluster_key.pub >> $USERDIR/authorized_keys
27+
ssh-keygen -t rsa -C "Cluster_Edition_Key" -f $SSHDIR/cluster_key -N '' &> /dev/null
28+
cat $SSHDIR/cluster_key.pub >> $SSHDIR/authorized_keys
2629
fi
27-
if [ ! -f $USERDIR/config ]; then
30+
if [ ! -f $SSHDIR/config ]; then
2831
echo "***configuring host"
29-
echo "IdentityFile $USERDIR/cluster_key" >> $USERDIR/config
30-
echo "IdentityFile $USERDIR/id_rsa" >> $USERDIR/config
32+
echo "IdentityFile $SSHDIR/cluster_key" >> $SSHDIR/config
33+
echo "IdentityFile $SSHDIR/id_rsa" >> $SSHDIR/config
3134
fi
3235
for host in $hosts; do
3336
echo "***copying public key to $host"
3437
ssh-keyscan -H $host >> ~/.ssh/known_hosts
35-
ssh-copy-id -i $USERDIR/cluster_key.pub $user@$host &> /dev/null
38+
ssh-copy-id -i $SSHDIR/cluster_key.pub $user@$host &> /dev/null
3639
echo "***copying key pair to remote host"
37-
scp $USERDIR/{cluster_key,cluster_key.pub,config} $user@$host:$USERDIR
40+
scp $SSHDIR/{cluster_key,cluster_key.pub,config} $user@$host:$SSHDIR
3841
done
3942

4043
for host in $hosts; do
4144
echo "***copying known_hosts to $host"
42-
scp $USERDIR/known_hosts $user@$host:$USERDIR/cluster_known_hosts
45+
scp $SSHDIR/known_hosts $user@$host:$SSHDIR/cluster_known_hosts
4346
ssh $user@$host "
44-
cat $USERDIR/cluster_known_hosts >> $USERDIR/known_hosts
45-
rm $USERDIR/cluster_known_hosts"
47+
cat $SSHDIR/cluster_known_hosts >> $SSHDIR/known_hosts
48+
rm $SSHDIR/cluster_known_hosts"
4649
done
4750

4851
}
@@ -60,10 +63,10 @@ function SSH_Daemon_Setup {
6063

6164
for host in $hosts; do
6265
echo "***copying sshd_config to $host"
63-
scp /etc/ssh/sshd_config $user@$host:$USERDIR
66+
scp /etc/ssh/sshd_config $user@$host:$SSHDIR
6467
ssh $user@$host "
65-
sudo cp $USERDIR/sshd_config /etc/ssh/sshd_config
66-
sudo rm -f $USERDIR/sshd_config
68+
sudo cp $SSHDIR/sshd_config /etc/ssh/sshd_config
69+
sudo rm -f $SSHDIR/sshd_config
6770
sudo service ssh restart"
6871
done
6972
fi

0 commit comments

Comments
 (0)