Try Ubuntu Landscape on Xenial (by quqi99)

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明 (http://blog.csdn.net/quqi99)

Landscape is used for manage your Ubuntu Cluster remotely. You can install Landscape directly on a machine running Xenial (Ubuntu 16.04), this is called “Landscape On Premises.” It is free for up to 10 physical machines and 10 more virtual machines for a total of 20.

Install Landscape Server

; refer https://askubuntu.com/questions/549809/how-do-i-install-landscape-for-personal-use
sudo ufw disable
sudo add-apt-repository ppa:landscape/17.03
sudo apt update
sudo apt install landscape-server-quickstart  
; register the landscape account using text based web brower, or visit 'https://'
sudo apt install links  
links https://

Register Landscape Clients

; now register ubuntu node
; copy /etc/landscape/landscape_server.pem from landscape server to every ubuntu nodes
sudo nano /etc/landscape/client.conf
  ssl_public_key = /etc/landscape/landscape_server.pem
sudo apt install landscape-client
sudo landscape-config --computer-title "node2" --account-name standalone  --url https://xenial/message-system --ping-url http://xenial/ping --ok-no-register --silent
; then accept this node in GUI page

Customized Installation for Landscape by Preseed

1, Prepare preseed.cfg and a customized script lds.sh

export DEBIAN_FRONTEND=noninteractive
apt-get install -y landscape-client
landscape-client --daemon --pid-file /run/landscape.pid
landscape-config --computer-title "node2" --account-name standalone  --url https://xenial/message-system --ping-url http://xenial/ping --ok-no-register --silent --http-proxy PROXY-URL --https-proxy PROXY-URL
kill $(cat /run/landscape.pid)

2, Use ‘python -m SimpleHTTPServer 8080’ to setup web server for them
3, After selecting language press F6 at installer welcome screen
4, Edit boot command and replace “file=/cdrom/preseed/ubuntu-server.seed” with “preseed/url=http://IP/preseed.cfg“, eg (https://bugs.launchpad.net/ubuntu/+source/preseed/+bug/1452202 ):

menuentry "Test" {
        linux ubuntu-installer/ppc64el/vmlinux tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false auto=true preseed/url=https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
        initrd ubuntu-installer/ppc64el/initrd.gz
}

5, Press Enter and complete installation

Landscape start process

1, ubuntu-installer calls the following command to install landscape-client package [1] and [2].

apt-install landscape-client || true

2, landscape-client package continues to register client. *-proxy options will be writed to /etc/default/landscape-client

# grep 'landscape-config' ./debian/landscape-client.postinst -A 11
landscape-config --silent --ok-no-register \
--computer-title "$COMPUTER_TITLE" \
--account-name "$ACCOUNT_NAME" \
--registration-key "$REGISTRATION_KEY" \
--url "$URL" \
--exchange-interval "$EXCHANGE_INTERVAL" \
--urgent-exchange-interval "$URGENT_EXCHANGE_INTERVAL" \
--ping-url "$PING_URL" \
--ping-interval "$PING_INTERVAL" \
--http-proxy "$HTTP_PROXY" \
--https-proxy "$HTTPS_PROXY" \
--tags "$TAGS"

3, landscape-client package uses start-stop-daemon helper to start landscape-client daemon. But, installer's chroot will not allow to run start-stop-daemon [3], so we need to restart machine to do workaround.

vim ./debian/landscape-client.init
FULL_COMMAND="start-stop-daemon --start --quiet --oknodo --startas $DAEMON --pidfile $PIDFILE -g $DAEMON_GROUP -- --daemon --pid-file $PIDFILE"

[1] http://bazaar.launchpad.net/~ubuntu-core-dev/pkgsel/ubuntu/revision/115
[2] http://bazaar.launchpad.net/~ubuntu-core-dev/pkgsel/ubuntu/view/head:/debian/postinst#L197
[3] https://github.com/linuxmint/ubiquity/blob/master/d-i/source/debian-installer-utils/chroot-setup.sh#L72

Appendix - the source code of ubuntu-installer

Ubuntu有两个Installer [3], 一个是修改版的Debian Installer [2](也叫d-i, 用C/bash写的), 一个用于desktop CD安装的Ubiquity[1] (前端用python写的,后端还是d-i, ‘bzr branch http://bazaar.launchpad.net/~ubuntu-installer/ubiquity/trunk‘)。
例如,要修改ubiquity源码(sudo apt-get source ubiquity)下的./d-i/source/preseed/debian/network-preseed.postinst文件,先从https://launchpad.net/d-i(debian对应的链接是https://anonscm.debian.org/cgit/d-i/)找到ubuntu修改后的d-i应该对应preseed,然后找到对应的源码为http://bazaar.launchpad.net/~ubuntu-installer/preseed/master/view/head:/debian/network-preseed.postinst (也可通过’bzr branch lp:preseed’或’bzr branch lp:~ubuntu-core-dev/preseed/ubuntu’命令下载源码).
sudo apt-get source preseed
bzr branch http://bazaar.launchpad.net/~ubuntu-core-dev/preseed/ubuntu

那么如何将修改的preseed debdiff生成iso文件呢?只需要先将preseed dput到ppa (preseed是没有patchless的,直接修改要修改的文件即可), 等它build完成之后然后再将debian-installer (sudo apt-get source debain-installer,不需要修改源文件,只需要在changelog中增加版本号) dput到ppa即可。等 build完之后便可以生成mini.iso ( http://ppa.launchpad.net/zhhuabj/xenial-sru-testing/ubuntu/dists/xenial/main/installer-amd64/20101020ubuntu451.19/images/netboot/mini.iso )。

如何测试这个mini.iso呢?和测试full iso的方法一样,启动后在选择语言处按TAB键(full iso是按F6键)进入grub菜单,然后添加url=http://192.168.99.135/xenial.preseed即可。在正式版出来之前只能使用mini.iso,full iso的日期可参见:https://wiki.ubuntu.com/BionicBeaver/ReleaseSchedule

[1] https://code.launchpad.net/~ubuntu-installer/ubiquity/trunk
[2] http://d-i.alioth.debian.org/doc/talks/debconf6/paper/
[3] https://wiki.ubuntu.com/Installer/Development
[4] http://bazaar.launchpad.net/~ubuntu-core-dev/preseed/ubuntu/view/head:/debian/network-preseed.postinst
[5] http://bazaar.launchpad.net/~ubuntu-installer/preseed/master/view/head:/debian/network-preseed.postinst
[6] https://anonscm.debian.org/cgit/d-i/preseed.git/tree/debian/network-preseed.postinst

Appendix - How to Create Certificate

; above /etc/landscape/landscape_server.pem is created automatically by landscape-server-quickstart, you can also do it by hand.
; create your own CA (Certificate Authority), then we will have ./demoCA/private/cakey.pem
; refer https://help.landscape.canonical.com/LDS/SSL
/usr/lib/ssl/misc/CA.pl -newca
; generate an SSL certificate signed by your new CA, then we will have newkey.pem
/usr/lib/ssl/misc/CA.pl -newreq-nodes
; sign your newly created SSL certificate with your newly created CA, then we will have newcert.pem
/usr/lib/ssl/misc/CA.pl -signreq
; install the files to Landscape
sudo mv newcert.pem /etc/ssl/certs/landscape.pem
sudo mv newkey.pem /etc/ssl/private/landscape.key
sudo cp demoCA/cacert.pem /etc/ssl/certs/landscape_server_ca.crt
; make Landscape Clients trust the newly created CA
copy /etc/ssl/certs/landscape_server_ca.crt from the LDS server to the client's directory /usr/local/share/ca-certificates/ and run 'sudo update-ca-certificates'.
; adding the certificate file to /etc/landscape/client.conf
ssl_public_key = /usr/local/share/ca-certificates/landscape_server_ca.crt

你可能感兴趣的:(Linux,Application)