| | 1 | = Setting up Environment for Institutional Federated Identity Access Management = |
| | 2 | |
| | 3 | |
| | 4 | == Minimum Hardware Requirement == |
| | 5 | |
| | 6 | PC or Server or VM with 8GB RAM |
| | 7 | |
| | 8 | |
| | 9 | == DNS requirement == |
| | 10 | |
| | 11 | Get following DNS added, |
| | 12 | |
| | 13 | 1. For the host computer |
| | 14 | |
| | 15 | iam.[your institution domain].ac.lk -> 192.248.xx.yy1 |
| | 16 | |
| | 17 | 2. for your identity database |
| | 18 | |
| | 19 | idb.[your institution domain].ac.lk -> 192.248.xx.yy2 |
| | 20 | |
| | 21 | 3. for your identity provider |
| | 22 | |
| | 23 | idp. [your institution domain].ac.lk -> 192.248.xx.yy3 |
| | 24 | |
| | 25 | 4. for your eduroam radius server |
| | 26 | |
| | 27 | irs. [your institution domain].ac.lk -> 192.248.xx.yy4 |
| | 28 | |
| | 29 | |
| | 30 | |
| | 31 | == Setting up the Host !Computer/Server == |
| | 32 | |
| | 33 | 1. Download Ubuntu 18.04 LTS and burn to a USB stick or to a CD ROM as bootable media |
| | 34 | |
| | 35 | 2. Change your bios setting to boot up from external media |
| | 36 | |
| | 37 | 3. install Ubuntu 18.04 LTS while setting |
| | 38 | |
| | 39 | the host name as '''iam''' |
| | 40 | |
| | 41 | domain as [your institution domain].ac.lk |
| | 42 | |
| | 43 | public IP detail |
| | 44 | |
| | 45 | 4. Login to Ubuntu and run following to update your system |
| | 46 | |
| | 47 | sudo apt-get update |
| | 48 | |
| | 49 | sudo apt-get dist-upgrade |
| | 50 | |
| | 51 | |
| | 52 | 5. If you have not yet properly setup the IP |
| | 53 | |
| | 54 | * `ifconfig` |
| | 55 | |
| | 56 | |
| | 57 | * `sudo nano /etc/netplan/50-cloud-init.yaml` |
| | 58 | |
| | 59 | {{{ |
| | 60 | network: |
| | 61 | version: 2 |
| | 62 | ethernets: |
| | 63 | enp0s3: |
| | 64 | dhcp4: no |
| | 65 | |
| | 66 | |
| | 67 | bridges: |
| | 68 | lxdbr0: |
| | 69 | dhcp4: no |
| | 70 | addresses: |
| | 71 | - 192.248.xx.yy1/24 |
| | 72 | gateway4: 192.248.xx.xyz |
| | 73 | nameservers: |
| | 74 | addresses: |
| | 75 | - 192.248.1.161 |
| | 76 | interfaces: |
| | 77 | - enp0s3 |
| | 78 | }}} |
| | 79 | |
| | 80 | * `sudo netplan apply` |
| | 81 | |
| | 82 | (You may need to reboot here) |
| | 83 | |
| | 84 | |
| | 85 | |
| | 86 | == Linux Container (LXC) Virtual Environment == |
| | 87 | |
| | 88 | LXC should be built in by default |
| | 89 | |
| | 90 | * `lxc version` |
| | 91 | |
| | 92 | |
| | 93 | 1. Initiate LXC (single host) |
| | 94 | |
| | 95 | * `lxd init` |
| | 96 | {{{ |
| | 97 | Would you like to use LXD clustering? (yes/no) [default=no]: |
| | 98 | Do you want to configure a new storage pool? (yes/no) [default=yes]: |
| | 99 | Name of the new storage pool [default=default]: |
| | 100 | Name of the storage backend to use (btrfs, ceph, dir, lvm, zfs) [default=zfs]: dir |
| | 101 | Would you like to connect to a MAAS server? (yes/no) [default=no]: |
| | 102 | Would you like to create a new local network bridge? (yes/no) [default=yes]: |
| | 103 | What should the new bridge be called? [default=lxdbr0]: |
| | 104 | What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: |
| | 105 | What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: |
| | 106 | Would you like LXD to be available over the network? (yes/no) [default=no]: yes |
| | 107 | Would you like stale cached images to be updated automatically? (yes/no) [default=yes] |
| | 108 | Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: |
| | 109 | }}} |
| | 110 | |
| | 111 | 2. Check remote repositories |
| | 112 | |
| | 113 | |
| | 114 | * `lxc remote list` |
| | 115 | |
| | 116 | |
| | 117 | 3. Local repositories |
| | 118 | |
| | 119 | |
| | 120 | * `lxc image list` |
| | 121 | |
| | 122 | |
| | 123 | 4. Remote images |
| | 124 | |
| | 125 | |
| | 126 | * `lxc image list images:` |
| | 127 | |
| | 128 | |
| | 129 | * `lxc image list images:ubuntu` |
| | 130 | |
| | 131 | |
| | 132 | |
| | 133 | 5. Create a Ubuntu Container |
| | 134 | |
| | 135 | |
| | 136 | * `lxc launch ubuntu:18.04 test-ct` |
| | 137 | |
| | 138 | * `lxc list` |
| | 139 | |
| | 140 | |
| | 141 | Delete a container |
| | 142 | |
| | 143 | * `lxc stop test-ct` |
| | 144 | |
| | 145 | * `lxc delete --force test-ct` |
| | 146 | |
| | 147 | 6. Create Three Production LXCs for your institute |
| | 148 | |
| | 149 | * `lxc launch ubuntu:18.04 idb` |
| | 150 | |
| | 151 | * `lxc copy idb idp` |
| | 152 | |
| | 153 | * `lxc copy idb irs` |
| | 154 | |
| | 155 | * `lxc start idp` |
| | 156 | |
| | 157 | * `lxc start irs` |
| | 158 | |
| | 159 | |
| | 160 | 7. !Using/Login to container |
| | 161 | |
| | 162 | * `lxc exec idb bash` |
| | 163 | |
| | 164 | * `lsb_release -dirc` |
| | 165 | |
| | 166 | * `free -m` |
| | 167 | |
| | 168 | * `nproc` |
| | 169 | |
| | 170 | * `uname -r` |
| | 171 | |
| | 172 | * `exit` |
| | 173 | |
| | 174 | |
| | 175 | 8. CT info |
| | 176 | |
| | 177 | * `lxc info idb` |
| | 178 | |
| | 179 | * `pstree -p [pid]` |
| | 180 | |
| | 181 | |
| | 182 | 9. CT configuration |
| | 183 | |
| | 184 | * `lxc config show idp` |
| | 185 | |
| | 186 | * `lxc profile list` |
| | 187 | |
| | 188 | * `lxc profile show default` |
| | 189 | |
| | 190 | |
| | 191 | 10. Restrict Memory |
| | 192 | |
| | 193 | * `lxc config set idb limits.memory 4096MB` |
| | 194 | |
| | 195 | * `lxc config show idb` |
| | 196 | |
| | 197 | * `lxc config set idp limits.memory 4096MB` |
| | 198 | |
| | 199 | * `lxc config set irs limits.memory 2048MB` |
| | 200 | |
| | 201 | |
| | 202 | 11. configure CT network IP |
| | 203 | |
| | 204 | * `ifconfig` |
| | 205 | |
| | 206 | * `nano /etc/netplan/50-cloud-init.yaml` |
| | 207 | |
| | 208 | {{{ |
| | 209 | network: |
| | 210 | version: 2 |
| | 211 | ethernets: |
| | 212 | enp0s3: |
| | 213 | dhcp4: no |
| | 214 | addresses: |
| | 215 | - 192.248.xx.yy2/24 |
| | 216 | gateway4: 192.248.xx.xdfs |
| | 217 | nameservers: |
| | 218 | addresses: |
| | 219 | - 192.248.1.161 |
| | 220 | |
| | 221 | }}} |
| | 222 | |
| | 223 | * `netplan generate` |
| | 224 | |
| | 225 | * `netplan apply` |
| | 226 | |
| | 227 | |
| | 228 | * `timedatectl set-timezone Asia/Colombo` |
| | 229 | |
| | 230 | |
| | 231 | |
| | 232 | 12. SSH to CTs |
| | 233 | |
| | 234 | * `nano /etc/ssh/sshd_config` |
| | 235 | |
| | 236 | change |
| | 237 | |
| | 238 | `PasswordAuthentication no` |
| | 239 | |
| | 240 | to |
| | 241 | |
| | 242 | `PasswordAuthentication yes` |
| | 243 | |
| | 244 | |
| | 245 | * Add a user by |
| | 246 | * `sudo adduser` |
| | 247 | * `sudo adduser <username>` |
| | 248 | |
| | 249 | * `sudo reboot` |
| | 250 | |
| | 251 | |
| | 252 | now you can ssh to your all three CTs over the network. Then you can follow the installation instruction for LDAP, IDP and IRS for the installation of relevant CTs. |
| | 253 | |
| | 254 | |
| | 255 | === OPTIONAL === |
| | 256 | |
| | 257 | |
| | 258 | 1. !Pull/Push file to CT |
| | 259 | |
| | 260 | * `echo helle there > myfile` |
| | 261 | |
| | 262 | * `lxc file push myfile idp/root/` |
| | 263 | |
| | 264 | * `lxc file pull idp/root/myfile /tmp` |
| | 265 | |
| | 266 | |
| | 267 | 2. Snapshot |
| | 268 | |
| | 269 | * `lxc snapshot idp idp1` |
| | 270 | |
| | 271 | * `lxc restore idp idp1` |