Changes between Initial Version and Version 1 of TutorialSetupLXC


Ignore:
Timestamp:
Jun 24, 2019, 5:37:42 AM (5 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TutorialSetupLXC

    v1 v1  
     1= Setting up Environment for Institutional Federated Identity Access Management =
     2
     3
     4== Minimum Hardware Requirement ==
     5
     6PC or Server or VM with 8GB RAM
     7
     8
     9== DNS requirement ==
     10
     11Get following DNS added,
     12
     131. For the host computer
     14
     15iam.[your institution domain].ac.lk -> 192.248.xx.yy1 
     16
     172.  for your identity database
     18
     19idb.[your institution domain].ac.lk -> 192.248.xx.yy2
     20
     213.  for your identity provider
     22
     23idp. [your institution domain].ac.lk -> 192.248.xx.yy3
     24
     254. for your eduroam radius server
     26
     27irs. [your institution domain].ac.lk -> 192.248.xx.yy4
     28
     29
     30
     31== Setting up the Host !Computer/Server ==
     32
     331. Download Ubuntu 18.04 LTS and burn to a USB stick or to a CD ROM as bootable media
     34
     352. Change your bios setting to boot up from external media
     36
     373. 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
     454.  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
     525. 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{{{
     60network:
     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
     88LXC should be built in by default
     89
     90* `lxc version`
     91
     92
     931. Initiate LXC (single host)
     94
     95* `lxd init`
     96{{{
     97Would you like to use LXD clustering? (yes/no) [default=no]:
     98Do you want to configure a new storage pool? (yes/no) [default=yes]:
     99Name of the new storage pool [default=default]:
     100Name of the storage backend to use (btrfs, ceph, dir, lvm, zfs) [default=zfs]: dir
     101Would you like to connect to a MAAS server? (yes/no) [default=no]:
     102Would you like to create a new local network bridge? (yes/no) [default=yes]:
     103What should the new bridge be called? [default=lxdbr0]:
     104What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
     105What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:
     106Would you like LXD to be available over the network? (yes/no) [default=no]: yes
     107Would you like stale cached images to be updated automatically? (yes/no) [default=yes]
     108Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]:
     109}}}
     110
     1112. Check remote repositories
     112
     113
     114* `lxc remote list`
     115
     116
     1173. Local repositories
     118
     119
     120* `lxc image list`
     121
     122
     1234. Remote images
     124
     125
     126* `lxc image list images:`
     127
     128
     129* `lxc image list images:ubuntu`
     130
     131
     132
     1335. 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
     1476. 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
     1607. !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
     1758. CT info
     176
     177* `lxc info idb`
     178
     179* `pstree -p [pid]`
     180
     181
     1829. CT configuration
     183
     184* `lxc config show idp`
     185
     186* `lxc profile list`
     187
     188* `lxc profile show default`
     189
     190
     19110. 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
     20211. configure CT network IP
     203
     204* `ifconfig`
     205
     206* `nano /etc/netplan/50-cloud-init.yaml`
     207
     208{{{
     209network:
     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
     23212. 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
     252now 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
     2581. !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
     2672. Snapshot
     268
     269* `lxc snapshot idp idp1`
     270
     271* `lxc restore idp idp1`