Merge "Force RPM to use Java 1.7, not newer versions"
[integration.git] / packaging / rpm / README.md
1 Everything required for building the Karaf OpenDaylight RPM.
2
3 Note that the currently supported version is Helium SR3.
4
5 ## Vagrant build environment
6
7 The included `Vagrantfile` provides a simple, but tested and known-working, build environment. We recommend using it when building an ODL RPM.
8
9 ```
10 [~/integration/packaging/rpm]$ vagrant status
11 Current machine states:
12
13 default                   not created (virtualbox)
14 [~/integration/packaging/rpm]$ vagrant up
15 [~/integration/packaging/rpm]$ vagrant ssh
16 [vagrant@localhost vagrant]$ cd /vagrant/
17 [vagrant@localhost vagrant]$ ls
18 build.sh  connect.sh  install.sh  opendaylight.spec  README.md  Vagrantfile
19 ```
20
21 ## Building the RPM
22
23 The `build.sh` script is a helper for building the RPM.
24
25 ```
26 SRPM built!
27 Location: /home/vagrant/rpmbuild/SRPMS/opendaylight-0.2.3-2.fc20.src.rpm
28 Assuming you want to move RPM off Vagrant box
29 Also renaming RPM, not actually tagged as for FC20 target OS
30 cp /home/vagrant/rpmbuild/SRPMS/opendaylight-0.2.3-2.fc20.src.rpm /vagrant/opendaylight-0.2.3-2.src.rpm
31 RPM built!
32 Location: /home/vagrant/rpmbuild/RPMS/noarch/opendaylight-0.2.3-2.fc20.noarch.rpm
33 Assuming you want to move RPM off Vagrant box
34 Also renaming RPM, not actually tagged as for FC20 target OS
35 cp /home/vagrant/rpmbuild/RPMS/noarch/opendaylight-0.2.3-2.fc20.noarch.rpm /vagrant/opendaylight-0.2.3-2.noarch.rpm
36 ```
37
38 ## Working with the ODL RPM
39
40 The familiar RPM-related commands apply to the OpenDaylight RPM.
41
42 ### Installing OpenDaylight via the RPM
43
44 The `install.sh` script is a helper for doing the install.
45
46 ```
47 [vagrant@localhost vagrant]$ ./install.sh
48 Installing ODL from ./opendaylight-0.2.3-2.noarch.rpm
49 ```
50
51 Here's a manual walk-through of the install and the resulting system changes.
52
53 ```
54 # Note that there's nothing in /opt before the install
55 [vagrant@localhost vagrant]$ ls /opt/
56 # Note that there are no opendaylight systemd files before install
57 [vagrant@localhost vagrant]$ ls /usr/lib/systemd/system | grep -i opendaylight
58 # If you want to test the install in the provided build env, install Java
59 [vagrant@localhost vagrant]$ sudo yum install -y java
60 # Install the ODL RPM
61 [vagrant@localhost vagrant]$ sudo rpm -i opendaylight-0.2.3-2.noarch.rpm
62 # Note that ODL is now installed in /opt
63 [vagrant@localhost vagrant]$ ls /opt/
64 opendaylight
65 # Note that there's now a systemd .service file for ODL
66 [vagrant@localhost vagrant]$ ls /usr/lib/systemd/system | grep -i opendaylight
67 opendaylight.service
68 ```
69
70 ### Uninstalling OpenDaylight via the RPM
71
72 The `uninstall.sh` script is a helper for uninstalling ODL.
73
74 ```
75 [vagrant@localhost vagrant]$ ./uninstall.sh
76 Uninstalling opendaylight-0.2.3
77 ```
78
79 Here's a manual walk-through of the uninstall and the resulting system changes.
80
81 ```
82 # Note that ODL is installed in /opt/
83 [vagrant@localhost vagrant]$ ls /opt/
84 opendaylight
85 # Note that there's a systemd .service file for ODL
86 [vagrant@localhost vagrant]$ ls /usr/lib/systemd/system | grep -i opendaylight
87 opendaylight.service
88 # Uninstall the ODL RPM
89 [vagrant@localhost vagrant]$ sudo rpm -e opendaylight-0.2.3
90 # Note that ODL has been removed from /opt/
91 [vagrant@localhost vagrant]$ ls /opt/
92 # Note that the ODL systemd .service file has been removed
93 [vagrant@localhost vagrant]$ ls /usr/lib/systemd/system | grep -i opendaylight
94 ```
95
96 ## Managing OpenDaylight via systemd
97
98 The OpenDaylight RPM ships with systemd support.
99
100 ### Starting OpenDaylight via systemd
101
102 ```
103 [vagrant@localhost vagrant]$ sudo systemctl start opendaylight
104 [vagrant@localhost vagrant]$ sudo systemctl status opendaylight
105 opendaylight.service - OpenDaylight SDN Controller
106    Loaded: loaded (/usr/lib/systemd/system/opendaylight.service; disabled)
107    Active: active (running) since Mon 2015-03-23 21:45:40 UTC; 34s ago
108      Docs: https://wiki.opendaylight.org/view/Main_Page
109            http://www.opendaylight.org/
110   Process: 13839 ExecStart=/opt/opendaylight/bin/start (code=exited, status=0/SUCCESS)
111  Main PID: 13846 (java)
112    CGroup: /system.slice/opendaylight.service
113            └─13846 java -server -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -X...
114
115 Mar 23 21:45:40 localhost.localdomain systemd[1]: Starting OpenDaylight SDN Control....
116 Mar 23 21:45:40 localhost.localdomain systemd[1]: Started OpenDaylight SDN Controller.
117 ```
118
119 ### Stopping OpenDaylight via systemd
120
121 ```
122 [vagrant@localhost vagrant]$ sudo systemctl stop opendaylight
123 [vagrant@localhost vagrant]$ sudo systemctl status opendaylight
124 opendaylight.service - OpenDaylight SDN Controller
125    Loaded: loaded (/usr/lib/systemd/system/opendaylight.service; disabled)
126    Active: inactive (dead)
127      Docs: https://wiki.opendaylight.org/view/Main_Page
128            http://www.opendaylight.org/
129 # snip
130 ```
131
132 ## Connecting to the Karaf shell
133
134 A few seconds after OpenDaylight is started, its Karaf shell will be accessible.
135
136 The `connect.sh` script is provided as an example of how to connect to the Karaf shell.
137
138 ```
139 [vagrant@localhost vagrant]$ ./connect.sh
140 Installing sshpass. It's used connecting non-interactively
141 # snip
142 opendaylight-user@root>
143 ```
144
145 Additionally, here's an example of connecting manually (password: `karaf`):
146
147 ```
148 [vagrant@localhost vagrant]$ ssh -p 8101 -o StrictHostKeyChecking=no karaf@localhost
149 Authenticated with partial success.
150 Password authentication
151 Password: 
152                                                                                            
153     ________                       ________                .__  .__       .__     __       
154     \_____  \ ______   ____   ____ \______ \ _____  ___.__.|  | |__| ____ |  |___/  |_     
155      /   |   \\____ \_/ __ \ /    \ |    |  \\__  \<   |  ||  | |  |/ ___\|  |  \   __\    
156     /    |    \  |_> >  ___/|   |  \|    `   \/ __ \\___  ||  |_|  / /_/  >   Y  \  |      
157     \_______  /   __/ \___  >___|  /_______  (____  / ____||____/__\___  /|___|  /__|      
158             \/|__|        \/     \/        \/     \/\/            /_____/      \/          
159                                                                                            
160
161 Hit '<tab>' for a list of available commands
162 and '[cmd] --help' for help on a specific command.
163 Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight.
164
165 opendaylight-user@root>^D
166 Connection to localhost closed.
167 [vagrant@localhost vagrant]$
168 ```