Browse code

Created Overview, Admin Guide structure, deleted RPM OSTRee files

Change-Id: I6419c219dc35560727b7d4dd4dd81e03a173e7c1
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6152
Reviewed-by: Stuart Clements <sclements@vmware.com>
Tested-by: Stuart Clements <sclements@vmware.com>

Vidya Vasudevan authored on 2018/11/12 17:57:25
Showing 90 changed files
1 1
deleted file mode 100644
... ...
@@ -1,41 +0,0 @@
1
-# Install and Configure DCOS CLI for Mesos
2
-
3
-To install the DCOS CLI:
4
-Install virtualenv. The Python tool virtualenv is used to manage the DCOS CLI’s environment.
5
-
6
-```
7
-sudo pip install virtualenv
8
-```
9
-
10
-Tip: On some older Python versions, ignore any ‘Insecure Platform’ warnings. For more information, see https://virtualenv.pypa.io/en/latest/installation.html. From the command line, create a new directory named dcos and navigate into it.
11
-
12
-```
13
-$ mkdir dcos
14
-$ cd dcos
15
-$ curl -O https://downloads.mesosphere.io/dcos-cli/install.sh
16
-```
17
-
18
-Run the DCOS CLI install script, where <hosturl> is the hostname of your master node prefixed with http://:
19
-```
20
-$ bash install.sh <install_dir> <mesos-master-host>
21
-```
22
-
23
-For example, if the hostname of your Mesos master node is mesos-master.example.com:
24
-
25
-```
26
-$ bash install.sh . http://mesos-master.example.com
27
-```
28
-
29
-Follow the on-screen DCOS CLI instructions and enter the Mesosphere verification code. You can ignore any Python ‘Insecure Platform’ warnings.
30
-
31
-```
32
-Confirm whether you want to add DCOS to your system PATH:
33
-$ Modify your bash profile to add DCOS to your PATH? [yes/no]
34
-```
35
-
36
-Since DCOS CLI is used for DCOS cluster, reconfigure Marathon and Mesos masters URLs with the following commands:
37
-
38
-```
39
-dcos config set core.mesos_master_url http://<mesos-master-host>:5050
40
-dcos config set marathon.url http://<marathon-host>:8080
41
-```
42 1
deleted file mode 100644
... ...
@@ -1,59 +0,0 @@
1
-# Install and Configure Marathon for Mesos Cluster on PhotonOS
2
-
3
-In this How-To I am going to explain how to install and configure Marathon for Mesos cluster. All the following steps should be done on each Mesos master.
4
-
5
-First, download Marathon:
6
-
7
-```
8
-root@pt-mesos-master2 [ ~ ]# mkdir -p  /opt/mesosphere/marathon/ && cd /opt/mesosphere/marathon/
9
-root@pt-mesos-master2 [ /opt/mesosphere/marathon ]#  curl -O http://downloads.mesosphere.com/marathon/v0.13.0/marathon-0.13.0.tgz
10
-root@pt-mesos-master2 [ /opt/mesosphere/marathon ]# tar -xf marathon-0.13.0.tgz
11
-root@pt-mesos-master2 [ /opt/mesosphere/marathon ]# mv marathon-0.13.0 marathon
12
-```
13
-
14
-Create a configuration for Marathon:
15
-
16
-```
17
-root@pt-mesos-master2 [ /opt/mesosphere/marathon ]# ls -l /etc/marathon/conf/
18
-total 8
19
--rw-r--r-- 1 root root 68 Dec 24 14:33 master
20
--rw-r--r-- 1 root root 71 Dec 24 14:33 zk
21
-root@pt-mesos-master2 [ /opt/mesosphere/marathon ]# cat /etc/marathon/conf/*
22
-zk://192.168.0.2:2181,192.168.0.1:2181,192.168.0.3:2181/mesos
23
-zk://192.168.0.2:2181,192.168.0.1:2181,192.168.0.3:2181/marathon
24
-root@pt-mesos-master2 [ /opt/mesosphere/marathon ]# cat /etc/systemd/system/marathon.service
25
-[Unit]
26
-Description=Marathon
27
-After=network.target
28
-Wants=network.target
29
- 
30
-[Service]
31
-Environment="JAVA_HOME=/opt/OpenJDK-1.8.0.51-bin"
32
-ExecStart=/opt/mesosphere/marathon/bin/start \
33
-    --master zk://192.168.0.2:2181,192.168.0.1:2181,192.168.0.3:2181/mesos \
34
-    --zk zk://192.168.0.2:2181,192.168.0.1:2181,192.168.0.3:2181/marathon
35
-Restart=always
36
-RestartSec=20
37
- 
38
-[Install]
39
-WantedBy=multi-user.target
40
-```
41
-
42
-Finally, we need to change the Marathon startup script, since PhotonOS do not use the standard JRE. 
43
-
44
-Make sure you add JAVA_HOME to Java path:
45
-
46
-```
47
-root@pt-mesos-master2 [ /opt/mesosphere/marathon ]# tail -n3 /opt/mesosphere/marathon/bin/start
48
-# Start Marathon
49
-marathon_jar=$(find "$FRAMEWORK_HOME"/target -name 'marathon-assembly-*.jar' | sort | tail -1)
50
-exec "${JAVA_HOME}/bin/java" "${java_args[@]}" -jar "$marathon_jar" "${app_args[@]}"
51
-```
52
-
53
-Now we can start the Marthon service:
54
-```
55
-root@pt-mesos-master2 [ /opt/mesosphere/marathon ]# systemctl start marathon
56
-root@pt-mesos-master2 [ /opt/mesosphere/marathon ]# ps -ef | grep marathon
57
-root     15821     1 99 17:14 ?        00:00:08 /opt/OpenJDK-1.8.0.51-bin/bin/java -jar /opt/mesosphere/marathon/bin/../target/scala-2.11/marathon-assembly-0.13.0.jar --master zk://192.168.0.2:2181,192.168.0.1:2181,192.168.0.3:2181/mesos --zk zk://192.168.0.2:2181,192.168.0.1:2181,192.168.0.3:2181/marathon
58
-root     15854 14692  0 17:14 pts/0    00:00:00 grep --color=auto marathon
59
-```
60 1
\ No newline at end of file
61 2
deleted file mode 100644
... ...
@@ -1,158 +0,0 @@
1
-# Install and Configure Mesos DNS on a Mesos Cluster
2
-
3
-## Overview 
4
-
5
-Before you read this How-To, please read: [Install and Configure a Production-Ready Mesos Cluster on PhotonOS](Install-and-Configure-a-Production-Ready-Mesos-Cluster-on-Photon-OS.md), [Install and Configure Marathon for Mesos Cluster on PhotonOS](Install-and-Configure-Marathon-for-Mesos-Cluster-on-PhotonOS.md) and [Install and Configure DCOS CLI for Mesos](Install-and-Configure-DCOS-CLI-for-Mesos.md).
6
-
7
-After you have fully installed and configured the Mesos cluster, you can execute jobs on it. However, if you want a service discovery and load balancing capabilities you will need to use Mesos-DNS and Haproxy. In this How-To I will explain how to install and configure Mesos-DNS for your Mesos cluster.
8
-Mesos-DNS supports service discovery in Apache Mesos clusters. It allows applications and services running on Mesos to find each other through the domain name system (DNS), similarly to how services discover each other throughout the Internet. Applications launched by Marathon are assigned names like search.marathon.mesos. Mesos-DNS translates these names to the IP address and port on the machine currently running each application. To connect to an application in the Mesos datacenter, all you need to know is its name. Every time a connection is initiated, the DNS translation will point to the right machine in the datacenter.
9
-
10
-![Architecture](images/architecture.png)
11
-
12
-## Installation
13
-
14
-I will explain how to configure Mesos-DNS docker and run it through Marathon. I will show you how to create a configuration file for a mesos-dns-docker container and how to run it via Marathon.
15
-
16
-```
17
-root@pt-mesos-node1 [ ~ ]# cat /etc/mesos-dns/config.json
18
-{
19
-  "zk": "zk://192.168.0.1:2181,192.168.0.2:2181,192.168.0.3:2181/mesos",
20
-  "masters": ["192.168.0.1:5050", "192.168.0.2:5050", "192.168.0.3:5050"],
21
-  "refreshSeconds": 60,
22
-  "ttl": 60,
23
-  "domain": "mesos",
24
-  "port": 53,
25
-  "resolvers": ["8.8.8.8"],
26
-  "timeout": 5,
27
-  "httpon": true,
28
-  "dnson": true,
29
-  "httpport": 8123,
30
-  "externalon": true,
31
-  "SOAMname": "ns1.mesos",
32
-  "SOARname": "root.ns1.mesos",
33
-  "SOARefresh": 60,
34
-  "SOARetry":   600,
35
-  "SOAExpire":  86400,
36
-  "SOAMinttl": 60
37
-}
38
-```
39
-
40
-### Create Application Run File
41
-
42
-Next step is to create a json file and run the service from Marathon for HA. It is possible to run the service via API or via DCOS CLI.
43
-
44
-```
45
-client:~/mesos/jobs$ cat mesos-dns-docker.json
46
-{
47
-    "args": [
48
-        "/mesos-dns",
49
-        "-config=/config.json"
50
-    ],
51
-    "container": {
52
-        "docker": {
53
-            "image": "mesosphere/mesos-dns",
54
-            "network": "HOST"
55
-        },
56
-        "type": "DOCKER",
57
-        "volumes": [
58
-            {
59
-                "containerPath": "/config.json",
60
-                "hostPath": "/etc/mesos-dns/config.json",
61
-                "mode": "RO"
62
-            }
63
-        ]
64
-    },
65
-    "cpus": 0.2,
66
-    "id": "mesos-dns-docker",
67
-    "instances": 3,
68
-    "constraints": [["hostname", "CLUSTER", "pt-mesos-node2.example.com"]]
69
-}
70
-```
71
-
72
-Now we can see in the Marthon and Mesos UI that we launched the application.
73
-
74
-
75
-### Setup Resolvers and Testing
76
-
77
-To allow Mesos tasks to use Mesos-DNS as the primary DNS server, you must edit the file */etc/resolv.conf* in every slave and add a new nameserver. For instance, if *mesos-dns* runs on the server with IP address *192.168.0.5* at the beginning of */etc/resolv.conf* on every slave.
78
-
79
-```
80
-root@pt-mesos-node2 [ ~/mesos-dns ]# cat /etc/resolv.conf
81
-# This file is managed by systemd-resolved(8). Do not edit.
82
-#
83
-# Third party programs must not access this file directly, but
84
-#only through the symlink at /etc/resolv.conf. To manage
85
-# resolv.conf(5) in a different way, replace the symlink by a
86
-# static file or a different symlink.
87
-nameserver 192.168.0.5
88
-nameserver 192.168.0.4
89
-nameserver 8.8.8.8
90
-```
91
-
92
-Let's run a simple Docker app and see if we can resolve it in DNS.
93
-
94
-```
95
-client:~/mesos/jobs$ cat docker.json
96
-{
97
-    "id": "docker-hello",
98
-    "container": {
99
-        "docker": {
100
-            "image": "centos"
101
-        },
102
-        "type": "DOCKER",
103
-        "volumes": []
104
-    },
105
-    "cmd": "echo hello; sleep 10000",
106
-    "mem": 16,
107
-    "cpus": 0.1,
108
-    "instances": 10,
109
-    "disk": 0.0,
110
-    "ports": [0]
111
-}
112
-```
113
-```
114
-client:~/mesos/jobs$ dcos marathon app add docker.json
115
-```
116
-
117
-Let's try to resolve it.
118
-
119
-```
120
-root@pt-mesos-node2 [ ~/mesos-dns ]# dig _docker-hello._tcp.marathon.mesos SRV
121
-;; Truncated, retrying in TCP mode.
122
-; <<>> DiG 9.10.1-P1 <<>> _docker-hello._tcp.marathon.mesos SRV
123
-;; global options: +cmd
124
-;; Got answer:
125
-;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25958
126
-;; flags: qr aa rd ra; QUERY: 1, ANSWER: 10, AUTHORITY: 0, ADDITIONAL: 10
127
-;; QUESTION SECTION:
128
-;_docker-hello._tcp.marathon.mesos. IN SRV
129
-;; ANSWER SECTION:
130
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31998 docker-hello-4bjcf-s2.marathon.slave.mesos.
131
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31844 docker-hello-jexm6-s1.marathon.slave.mesos.
132
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31111 docker-hello-6ms44-s2.marathon.slave.mesos.
133
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31719 docker-hello-muhui-s2.marathon.slave.mesos.
134
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31360 docker-hello-jznf4-s1.marathon.slave.mesos.
135
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31306 docker-hello-t41ti-s1.marathon.slave.mesos.
136
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31124 docker-hello-mq3oz-s1.marathon.slave.mesos.
137
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31816 docker-hello-tcep8-s1.marathon.slave.mesos.
138
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31604 docker-hello-5uu37-s1.marathon.slave.mesos.
139
-_docker-hello._tcp.marathon.mesos. 60 IN SRV 0 0 31334 docker-hello-jqihw-s1.marathon.slave.mesos.
140
- 
141
-;; ADDITIONAL SECTION:
142
-docker-hello-muhui-s2.marathon.slave.mesos. 60 IN A 192.168.0.5
143
-docker-hello-4bjcf-s2.marathon.slave.mesos. 60 IN A 192.168.0.5
144
-docker-hello-jexm6-s1.marathon.slave.mesos. 60 IN A 192.168.0.6
145
-docker-hello-jqihw-s1.marathon.slave.mesos. 60 IN A 192.168.0.6
146
-docker-hello-mq3oz-s1.marathon.slave.mesos. 60 IN A 192.168.0.6
147
-docker-hello-tcep8-s1.marathon.slave.mesos. 60 IN A 192.168.0.6
148
-docker-hello-6ms44-s2.marathon.slave.mesos. 60 IN A 192.168.0.5
149
-docker-hello-t41ti-s1.marathon.slave.mesos. 60 IN A 192.168.0.4
150
-docker-hello-jznf4-s1.marathon.slave.mesos. 60 IN A 192.168.0.4
151
-docker-hello-5uu37-s1.marathon.slave.mesos. 60 IN A 192.168.0.4
152
-;; Query time: 0 msec
153
-;; SERVER: 192.168.0.5#53(192.168.0.5)
154
-;; WHEN: Sun Dec 27 14:36:32 UTC 2015
155
-;; MSG SIZE  rcvd: 1066
156
-```
157
-
158
-We can see that we can resolve our app.
159 1
\ No newline at end of file
160 2
deleted file mode 100644
... ...
@@ -1,175 +0,0 @@
1
-# Install and Configure a Production Ready Mesos Cluster on Photon OS
2
-
3
-## Overview
4
-
5
-For this setup I will use 3 Mesos masters and 3 slaves. On each Mesos master I will run a Zookeeper, meaning that we will have 3 Zookeepers as well. The Mesos cluster will be configured with a quorum of 2. For networking Mesos use Mesos-DNS. I tried to run Mesos-DNS as container, but got into some resolving issues, so in my next How-To I will explain how to configure Mesos-DNS and run it through Marathon. Photon hosts will be used for masters and slaves.
6
-
7
-**Masters:**
8
-
9
-| Hostname | IP Address|
10
-|-
11
-| pt-mesos-master1.example.com | 192.168.0.1 |
12
-| pt-mesos-master2.example.com | 192.168.0.2 |
13
-| pt-mesos-master3.example.com | 192.168.0.3 |
14
-
15
-**Agents:**
16
-
17
-| Hostname | IP Address|
18
-|-
19
-| pt-mesos-node1.example.com | 192.168.0.4 |
20
-| pt-mesos-node2.example.com | 192.168.0.5 |
21
-| pt-mesos-node3.example.com | 192.168.0.6
22
-
23
-## Masters Installation and Configuration 
24
-
25
-First of all we will install Zookeeper. Since currently there is a bug in Photon related to the Zookeeper installation I will use the tarball. Do the following for each master:
26
-
27
-```
28
-root@pt-mesos-master1 [ ~ ]# mkdir -p /opt/mesosphere && cd /opt/mesosphere && wget http://apache.mivzakim.net/zookeeper/stable/zookeeper-3.4.7.tar.gz
29
-root@pt-mesos-master1 [ /opt/mesosphere ]# tar -xf zookeeper-3.4.7.tar.gz && mv zookeeper-3.4.7 zookeeper
30
-root@pt-mesos-master1 [ ~ ]# cat /opt/mesosphere/zookeeper/conf/zoo.cfg | grep -v '#'
31
-tickTime=2000
32
-initLimit=10
33
-syncLimit=5
34
-dataDir=/var/lib/zookeeper
35
-clientPort=2181
36
-server.1=192.168.0.1:2888:3888
37
-server.2=192.168.0.2:2888:3888
38
-server.3=192.168.0.3:2888:3888
39
-```
40
-
41
-Example of Zookeeper systemd configuration file:
42
-```
43
-root@pt-mesos-master1 [ ~ ]# cat /etc/systemd/system/zookeeper.service
44
-[Unit]
45
-Description=Apache ZooKeeper
46
-After=network.target
47
- 
48
-[Service]
49
-Environment="JAVA_HOME=/opt/OpenJDK-1.8.0.51-bin"
50
-WorkingDirectory=/opt/mesosphere/zookeeper
51
-ExecStart=/bin/bash -c "/opt/mesosphere/zookeeper/bin/zkServer.sh start-foreground"
52
-Restart=on-failure
53
-RestartSec=20
54
-User=root
55
-Group=root
56
- 
57
-[Install]
58
-WantedBy=multi-user.target
59
-```
60
-
61
-Add server id to the configuration file, so zookeeper will understand the id of your master server. 
62
-This should be done for each master with its own id.
63
-
64
-```
65
-root@pt-mesos-master1 [ ~ ]# echo 1 > /var/lib/zookeeper/myid
66
-root@pt-mesos-master1 [ ~ ]# cat /var/lib/zookeeper/myid
67
-1
68
-```
69
-
70
-Now lets install the Mesos masters. Do the following for each master:
71
-```
72
-root@pt-mesos-master1 [ ~ ]# yum -y install mesos
73
-Setting up Install Process
74
-Package mesos-0.23.0-2.ph1tp2.x86_64 already installed and latest version
75
-Nothing to do
76
-root@pt-mesos-master1 [ ~ ]# cat /etc/systemd/system/mesos-master.service
77
-[Unit]
78
-Description=Mesos Slave
79
-After=network.target
80
-Wants=network.target
81
- 
82
-[Service]
83
-ExecStart=/bin/bash -c "/usr/sbin/mesos-master \
84
-    --ip=192.168.0.1 \
85
-    --work_dir=/var/lib/mesos \
86
-    --log_dir=/var/log/mesos \
87
-    --cluster=EXAMPLE \
88
-    --zk=zk://192.168.0.1:2181,192.168.0.2:2181,192.168.0.3:2181/mesos \
89
-    --quorum=2"
90
-KillMode=process
91
-Restart=always
92
-RestartSec=20
93
-LimitNOFILE=16384
94
-CPUAccounting=true
95
-MemoryAccounting=true
96
- 
97
-[Install]
98
-WantedBy=multi-user.target
99
-```
100
-
101
-Make sure you replace *ip* setting on each master. So far we have 3 masters with a Zookeeper and Mesos packages installed. Let's start zookeeper and mesos-master services on each master:
102
-
103
-```
104
-root@pt-mesos-master1 [ ~ ]# systemctl start zookeeper
105
-root@pt-mesos-master1 [ ~ ]# systemctl start mesos-master
106
-root@pt-mesos-master1 [ ~ ]# ps -ef | grep mesos
107
-root     11543     1  7 12:09 ?        00:00:01 /opt/OpenJDK-1.8.0.51-bin/bin/java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /opt/mesosphere/zookeeper/bin/../build/classes:/opt/mesosphere/zookeeper/bin/../build/lib/*.jar:/opt/mesosphere/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/opt/mesosphere/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/opt/mesosphere/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/opt/mesosphere/zookeeper/bin/../lib/log4j-1.2.16.jar:/opt/mesosphere/zookeeper/bin/../lib/jline-0.9.94.jar:/opt/mesosphere/zookeeper/bin/../zookeeper-3.4.7.jar:/opt/mesosphere/zookeeper/bin/../src/java/lib/*.jar:/opt/mesosphere/zookeeper/bin/../conf: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /opt/mesosphere/zookeeper/bin/../conf/zoo.cfg
108
-root     11581     1  0 12:09 ?        00:00:00 /usr/sbin/mesos-master --ip=192.168.0.1 --work_dir=/var/lib/mesos --log_dir=/var/lob/mesos --cluster=EXAMPLE --zk=zk://192.168.0.2:2181,192.168.0.1:2181,192.168.0.3:2181/mesos --quorum=2
109
-root     11601  9117  0 12:09 pts/0    00:00:00 grep --color=auto mesos
110
-```
111
-
112
-## Slaves Installation and Configuration 
113
-
114
-The steps for configuring a Mesos slave are very simple and not very different from master installation. The difference is that we won't install zookeeper on each slave. We will also start the Mesos slaves in slave mode and will tell the daemon to join the Mesos masters. Do the following for each slave:
115
-
116
-```
117
-root@pt-mesos-node1 [ ~ ]# cat /etc/systemd/system/mesos-slave.service
118
-[Unit]
119
-Description=Photon instance running as a Mesos slave
120
-After=network-online.target,docker.service
121
-  
122
-[Service]
123
-Restart=on-failure
124
-RestartSec=10
125
-TimeoutStartSec=0
126
-ExecStartPre=/usr/bin/rm -f /tmp/mesos/meta/slaves/latest
127
-ExecStart=/bin/bash -c "/usr/sbin/mesos-slave \
128
-    --master=zk://192.168.0.1:2181,192.168.0.2:2181,192.168.0.3:2181/mesos \
129
-        --hostname=$(/usr/bin/hostname) \
130
-        --log_dir=/var/log/mesos_slave \
131
-        --containerizers=docker,mesos \
132
-        --docker=$(which docker) \
133
-        --executor_registration_timeout=5mins \
134
-        --ip=192.168.0.4"
135
-  
136
-[Install]
137
-WantedBy=multi-user.target
138
-```
139
-
140
-Please make sure to replace the NIC name under *ip* setting. Start the mesos-slave service on each node.
141
-
142
-Now you should have ready Mesos cluster with 3 masters, 3 Zookeepers and 3 slaves. 
143
-
144
-If you want to use private docker registry, you will need to edit docker systemd file. 
145
-
146
-In my example I am using cse-artifactory.eng.vmware.com registry:
147
-
148
-```
149
-root@pt-mesos-node1 [ ~ ]# cat /lib/systemd/system/docker.service
150
-[Unit]
151
-Description=Docker Daemon
152
-Wants=network-online.target
153
-After=network-online.target
154
-  
155
-[Service]
156
-EnvironmentFile=-/etc/sysconfig/docker
157
-ExecStart=/bin/docker -d $OPTIONS -s overlay
158
-ExecReload=/bin/kill -HUP $MAINPID
159
-KillMode=process
160
-Restart=always
161
-MountFlags=slave
162
-LimitNOFILE=1048576
163
-LimitNPROC=1048576
164
-LimitCORE=infinity
165
-  
166
-[Install]
167
-WantedBy=multi-user.target
168
-  
169
-root@pt-mesos-node1 [ ~ ]# cat /etc/sysconfig/docker
170
-OPTIONS='--insecure-registry cse-artifactory.eng.vmware.com'
171
-root@pt-mesos-node1 [ ~ ]# systemctl daemon-reload && systemctl restart docker
172
-root@pt-mesos-node1 [ ~ ]# ps -ef | grep cse-artifactory
173
-root      5286     1  0 08:39 ?        00:00:00 /bin/docker -d --insecure-registry <your_privet_registry> -s overlay
174
-```
175
-
176 1
deleted file mode 100644
... ...
@@ -1,287 +0,0 @@
1
-# Install and Configure a Swarm Cluster with DNS Service on PhotonOS
2
-
3
-## Overview
4
-
5
-In this How-To, the steps for installing and configuring a Docker Swarm cluster, alongside DNS and Zookeeper, will be presented.
6
-
7
-The cluster that will be set up will be on VMware Photon hosts. 
8
-
9
-A prerequisite to using this guide is to be familiar with Docker Swarm - information can be found [here](https://docs.docker.com/swarm/).
10
-
11
-## Cluster description
12
-
13
-The cluster will have 2 Swarm Managers and 3 Swarm Agents:
14
-
15
-**Master**
16
-
17
-| Hostname | IP Address|
18
-|-
19
-| pt-swarm-master1.example.com | 192.168.0.1 |
20
-| pt-swarm-master2.example.com | 192.168.0.2 |
21
-
22
-**Agents**
23
-
24
-| Hostname | IP Address|
25
-|-
26
-| pt-swarm-agent1.example.com | 192.168.0.3 |
27
-| pt-swarm-agent2.example.com | 192.168.0.4 |
28
-| pt-swarm-agent3.example.com | 192.168.0.5 |
29
-
30
-## Docker Swarm Installation and Configuration
31
-
32
-### Setting Up the Managers
33
-
34
-The following steps should be done on both managers.
35
-
36
-Docker Swarm supports multiple methods of using service discovery, but in order to use failover, Consul, etcd or Zookeeper must be used. In this guide, Zookeeper will be used.
37
-
38
-Download the latest stable version of Zookeeper and create the *zoo.cfg* file under the *conf* directory:
39
-
40
-#### Zookeeper installation
41
-
42
-```
43
-root@pt-swarm-master1 [ ~ ]# mkdir -p /opt/swarm && cd /opt/swarm && wget http://apache.mivzakim.net/zookeeper/stable/zookeeper-3.4.6.tar.gz
44
-root@pt-swarm-master1 [ /opt/swarm ]# tar -xf zookeeper-3.4.6.tar.gz && mv zookeeper-3.4.6 zookeeper
45
-root@pt-swarm-master1 [ ~ ]# cat /opt/swarm/zookeeper/conf/zoo.cfg | grep -v '#'
46
-tickTime=2000
47
-initLimit=10
48
-syncLimit=5
49
-dataDir=/var/lib/zookeeper
50
-clientPort=2181
51
-server.1=192.168.0.1:2888:3888
52
-server.2=192.168.0.2:2888:3888
53
-```
54
-
55
-The dataDir should be an empty, existing directory.
56
-From the Zookeeper documentation: Every machine that is part of the ZooKeeper ensemble should know about every other machine in the ensemble. You accomplish this with the series of lines of the form server.id=host:port:port. You attribute the server id to each machine by creating a file named myid, one for each server, which resides in that server's data directory, as specified by the configuration file parameter dataDir. The myid file consists of a single line containing only the text of that machine's id. So myid of server 1 would contain the text "1" and nothing else. The id must be unique within the ensemble and should have a value between 1 and 255.
57
-
58
-Set Zookeeper ID
59
-```
60
-root@pt-swarm-master1 [ ~ ]# echo 1 > /var/lib/zookeeper/myid
61
-</source><br />
62
-Project Photon uses [https://en.wikipedia.org/wiki/Systemd Systemd] for services, so a zookeeper service should be created using systemd unit file.<br />
63
-<source lang="bash" enclose="div">
64
-root@pt-swarm-master1 [ ~ ]# cat /etc/systemd/system/zookeeper.service
65
-[Unit]
66
-Description=Apache ZooKeeper
67
-After=network.target
68
- 
69
-[Service]
70
-Environment="JAVA_HOME=/opt/OpenJDK-1.8.0.51-bin"
71
-WorkingDirectory=/opt/swarm/zookeeper
72
-ExecStart=/bin/bash -c "/opt/swarm/zookeeper/bin/zkServer.sh start-foreground"
73
-Restart=on-failure
74
-RestartSec=20
75
-User=root
76
-Group=root
77
- 
78
-[Install]
79
-WantedBy=multi-user.target
80
-```
81
-
82
-Zookeeper comes with OpenJDK, so having Java on the Photon host is not a prerequisite. Simply direct the Environment variable to the location where the Zookeeper was extracted.
83
-Now you need to enable and start the service. Enabling the service will make sure that if the host restarts for some reason, the service will automatically start.
84
-
85
-```
86
-root@pt-swarm-master1 [ ~ ]# systemctl enable zookeeper
87
-root@pt-swarm-master1 [ ~ ]# systemctl start zookeeper
88
-</source><br />
89
-Verify that the service was able to start:<br />
90
-<source lang="bash" enclose="div">
91
-root@pt-swarm-master1 [ ~ ]# systemctl status zookeeper
92
-zookeeper.service - Apache ZooKeeper
93
-   Loaded: loaded (/etc/systemd/system/zookeeper.service; enabled)
94
-   Active: active (running) since Tue 2016-01-12 00:27:45 UTC; 10s ago
95
- Main PID: 4310 (java)
96
-   CGroup: /system.slice/zookeeper.service
97
-           `-4310 /opt/OpenJDK-1.8.0.51-bin/bin/java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /opt/swarm/zookeeper/bin/../build/classes:/opt/swarm/zookeeper/bin/../build/lib/*.jar:/opt/s...
98
-```
99
-
100
-On the Manager you elected to be the Swarm Leader (primary), execute the following (if you do not have a specific leader in mind, choose one of the managers randomly):
101
-
102
-```
103
-root@pt-swarm-master1 [ ~ ]# docker run -d --name=manager1 -p 8888:2375 swarm manage --replication --advertise 192.168.0.1:8888 zk://192.168.0.1,192.168.0.2/swarm
104
-```
105
-
106
-* *docker run -d* - run the container in the background.
107
-* *--name=manager1* - give the container a name instead of the auto-generated one.
108
-* *-p 8888:2375* - publish a container's port(s) to the host. In this case, when you connect to the host in port 8888, it connects to the container in port 2375.
109
-* swarm - the image to use for the container.
110
-* manage - the command to send to the container once it's up, alongside the rest of the parameters.
111
-* *--replication* - tells swarm that the manager is part of a a multi-manager configuration and that this primary manager competes with other manager instances for the primary role. The primary manager has the authority to manage the cluster, replicate logs, and replicate events that are happening inside the cluster.
112
-* *--advertise 192.168.0.1:8888* - specifies the primary manager address. Swarm uses this address to advertise to the cluster when the node is elected as the primary.
113
-* *zk://192.168.0.1,192.168.0.2/swarm* - specifies the Zookeepers' location to enable service discovery. The /swarm path is arbitrary, just make sure that every node that joins the cluster specifies that same path (it is meant to enable support for multiple clusters with the same Zookeepers).
114
-
115
-On the second manager, execute the following:
116
-
117
-```
118
-root@pt-swarm-master2 [ ~ ]# docker run -d --name=manager2 -p 8888:2375 swarm manage --replication --advertise 192.168.0.2:8888 zk://192.168.0.1,192.168.0.2/swarm
119
-```
120
-
121
-Notice that the only difference is the --advertise flag value. The first manager will not lose leadership following this command.
122
-
123
-Now 2 managers are alive, one is the primary and another is the replica. When we now look at the docker info on our primary manager, we can see the following information:
124
-
125
-```
126
-docker-client:~$ docker -H tcp://192.168.0.1:8888 info
127
-Containers: 0
128
-Images: 0
129
-Role: primary
130
-Strategy: spread
131
-Filters: health, port, dependency, affinity, constraint
132
-Nodes: 0
133
-CPUs: 0
134
-Total Memory: 0 B
135
-Name: 82b8516efb7c
136
-```
137
-
138
-There are a few things that are worth noticing:
139
-
140
-* The info command can be executed from ANY machine that can reach the master. The -H tcp://<ip>:<port> command specifies that the docker command should be executed on a remote host.
141
-* Containers - this is the result of the docker ps -a command for the cluster we just set up.
142
-* Images - the result of the docker images command.
143
-* Role - as expected, this is the primary manager.
144
-* Strategy - Swarm has a number of strategies it supports for setting up containers in the cluster. spread means that a new container will run on the node with the least amount of containers on it.
145
-* Filters - Swarm can choose where to run containers based on different filters supplied in the command line. More info can be found [here](https://docs.docker.com/swarm/scheduler/filter/).
146
-
147
-
148
-When we now look at the docker info on our replicated manager, we can see the following information:
149
-
150
-```
151
-docker-client:~$ docker -H tcp://192.168.0.2:8888 info
152
-Containers: 0
153
-Images: 0
154
-Role: replica
155
-Primary: 192.168.0.1:8888
156
-Strategy: spread
157
-Filters: health, port, dependency, affinity, constraint
158
-Nodes: 0
159
-CPUs: 0
160
-Total Memory: 0 B
161
-Name: ac06f826e507
162
-```
163
-
164
-Notice that the only differences between both managers are:
165
-Role: as expected, this is the replicated manager.
166
-Primary: contains the primary manager.
167
-
168
-#### Setting Up the Agents
169
-
170
-In Swarm, in order for a node to become a part of the cluster, it should "join" that said cluster - do the following for each of the agents.
171
-Edit the */usr/lib/systemd/system/docker.service* file so that each agent will be able to join the cluster:
172
-
173
-```
174
-root@pt-swarm-agent1 [ ~ ]# cat /usr/lib/systemd/system/docker.service
175
-[Unit]
176
-Description=Docker Daemon
177
-Wants=network-online.target
178
-After=network-online.target
179
- 
180
-[Service]
181
-ExecStart=/bin/docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --cluster-advertise eno16777984:2375 --cluster-store zk://192.168.0.1,192.168.0.2/swarm
182
-ExecReload=/bin/kill -HUP $MAINPID
183
-KillMode=process
184
-Restart=always
185
-MountFlags=slave
186
-LimitNOFILE=1048576
187
-LimitNPROC=1048576
188
-LimitCORE=infinity
189
- 
190
-[Install]
191
-WantedBy=multi-user.target
192
-```
193
-
194
-* -H tcp://0.0.0.0:2375 - This ensures that the Docker remote API on Swarm Agents is available over TCP for the Swarm Manager.
195
-* -H unix:///var/run/docker.sock - The Docker daemon can listen for Docker Remote API requests via three different types of Socket: unix, tcp, and fd. 
196
-    * tcp - If you need to access the Docker daemon remotely, you need to enable the tcp Socket.
197
-    * fd - On Systemd based systems, you can communicate with the daemon via Systemd socket activation.
198
-* *--cluster-advertise <NIC>:2375* - advertises the machine on the network by stating the ethernet card and the port used by the Swarm Managers.
199
-* --cluster-store zk://192.168.0.1,192.168.0.2/swarm - as we defined before, the service discovery being used here is Zookeeper.
200
-
201
-Enable and start the docker service:
202
-
203
-```
204
-root@pt-swarm-agent1 [ ~ ]# systemctl enable docker
205
-root@pt-swarm-agent1 [ ~ ]# systemctl daemon-reload && systemctl restart docker
206
-root@pt-swarm-agent1 [ ~ ]# systemctl status docker
207
-docker.service - Docker Daemon
208
-   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
209
-   Active: active (running) since Tue 2016-01-12 00:46:18 UTC; 4s ago
210
- Main PID: 11979 (docker)
211
-   CGroup: /system.slice/docker.service
212
-           `-11979 /bin/docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --cluster-advertise eno16777984:2375 --cluster-store zk://192.168.0.1,192.168.0.2/swarm
213
-```
214
-
215
-All that remains is to have the agents join the cluster:
216
-```
217
-root@pt-swarm-agent1 [ ~ ]# docker run -d swarm join --advertise=192.168.0.3:2375 zk://192.168.0.1,192.168.0.2/swarm
218
-```
219
-
220
-A look at the output of the docker info command will now show:
221
-```
222
-docker-client:~$ docker -H tcp://192.168.0.1:8888 info
223
-Containers: 3
224
-Images: 9
225
-Role: primary
226
-Strategy: spread
227
-Filters: health, port, dependency, affinity, constraint
228
-Nodes: 3
229
- pt-swarm-agent1.example.com: 192.168.0.3:2375
230
-  └ Status: Healthy
231
-  └ Containers: 1
232
-  └ Reserved CPUs: 0 / 1
233
-  └ Reserved Memory: 0 B / 2.055 GiB
234
-  └ Labels: executiondriver=native-0.2, kernelversion=4.1.3-esx, operatingsystem=VMware Photon/Linux, storagedriver=overlay
235
- pt-swarm-agent2.example.com: 192.168.0.4:2375
236
-  └ Status: Healthy
237
-  └ Containers: 1
238
-  └ Reserved CPUs: 0 / 1
239
-  └ Reserved Memory: 0 B / 2.055 GiB
240
-  └ Labels: executiondriver=native-0.2, kernelversion=4.1.3-esx, operatingsystem=VMware Photon/Linux, storagedriver=overlay
241
- pt-swarm-agent3.example.com: 192.168.0.5:2375
242
-  └ Status: Healthy
243
-  └ Containers: 1
244
-  └ Reserved CPUs: 0 / 1
245
-  └ Reserved Memory: 0 B / 2.055 GiB
246
-  └ Labels: executiondriver=native-0.2, kernelversion=4.1.3-esx, operatingsystem=VMware Photon/Linux, storagedriver=overlay
247
-CPUs: 3
248
-Total Memory: 6.166 GiB
249
-Name: 82b8516efb7c
250
-```
251
-
252
-#### Setting Up DNS
253
-
254
-Docker does not have its own self-provided DNS so we use a [https://github.com/ahmetalpbalkan/wagl wagl] DNS.
255
-Setting it up is very simple. In this case, one of the masters will also be the DNS. Simply execute:
256
-
257
-```
258
-docker-client:~$ docker run -d --restart=always --name=dns -p 53:53/udp --link manager1:swarm ahmet/wagl wagl --swarm tcp://swarm:2375
259
-```
260
-
261
-* *--restart=always* - Always restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container continuously. The container will also always start on daemon startup, regardless of the current state of the container.
262
-* *--link manager1:swarm* - link the manager1 container (by name) and give it the alias swarm.
263
-That's it, DNS is up and running.
264
-
265
-### Test Your Cluster 
266
-
267
-#### Running Nginx
268
-
269
-Execute the following commands from any docker client:
270
-
271
-```
272
-docker-client:~$ docker -H tcp://192.168.0.1:8888 run -d -l dns.service=api -l dns.domain=example -p 80:80 vmwarecna/nginx
273
-docker-client:~$ docker -H tcp://192.168.0.1:8888 run -d -l dns.service=api -l dns.domain=example -p 80:80 vmwarecna/nginx
274
-```
275
-
276
-Note that this is the same command, executed twice. It tells the master to run 2 of the similar containers, each of which has 2 dns labels.
277
-
278
-Now, from any container in the cluster that has dnsutils, you can execute the following (for example):
279
-
280
-```
281
-root@13271a2d0fcb:/# dig +short A api.example.swarm
282
-192.168.0.3
283
-192.168.0.4
284
-root@13271a2d0fcb:/# dig +short SRV _api._tcp.example.swarm
285
-1 1 80 192.168.0.3.
286
-1 1 80 192.168.0.4.
287
-```
288 1
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+# Overview of Photon OS
1
+
2
+*Overview of Photon OS* provides an introduction to Photon OS, it versions, and distinguishing features.
3
+
4
+**Product version: 3.0**
5
+
6
+This documentation applies to all 3.0.x releases.
7
+
8
+## Intended Audiences
9
+
10
+This information is intended for Photon OS administrators who install and set up Photon OS.
11
+
12
+----------
13
+
14
+Copyright &copy; 2016-2018 VMware, Inc. All rights reserved. [Copyright and trademark information](http://pubs.vmware.com/copyright-trademark.html). Any feedback you provide to VMware is subject to the terms at [www.vmware.com/community_terms.html](http://www.vmware.com/community_terms.html).
15
+
16
+**VMware, Inc.**<br>
17
+3401 Hillview Ave.<br>
18
+Palo Alto, CA 94304
19
+
20
+[www.vmware.com](http://www.vmware.com)
21
+
0 22
deleted file mode 100644
... ...
@@ -1,52 +0,0 @@
1
-# Introduction
2
-
3
-## 1.1 What is OSTree? How about RPM-OSTree?
4
-
5
-OSTree is a tool to manage bootable, immutable, versioned filesystem trees. Unlike traditional package managers like rpm or dpkg that know how to install, uninstall, configure packages, OSTree has no knowledge of the relationship between files. But when you add rpm capabilities on top of OSTree, it becomes RPM-OSTree, meaning a filetree replication system that is also package-aware.   
6
-The idea behind it is to use a client / server architecture to keep your Linux installed machines (physical or VM) in sync with the latest bits, in a predictable and reliable manner. To achieve that, OSTree uses a git-like repository that records the changes to any file and replicate them to any subscriber.  
7
-A system administrator or an image builder developer takes a base Linux image, prepares the packages and other configuration on a server box, executes a command to compose a filetree that the host machines will download and then incrementally upgrade whenever a new change has been committed.
8
-You may read more about OSTree [here](https://wiki.gnome.org/Projects/OSTree).
9
-
10
-## 1.2 Why use RPM-OSTree in Photon?
11
-There are several important benefits:
12
-* Reliable, efficient: The filetree replication is simple, reliable and efficient. It will only transfer deltas over the network. If you have deployed two almost identical bootable images on same box (differing just by several files), it will not take twice the space. The new tree will have a set of hardlinks to the old tree and only the different files will have a separate copy stored to disk.
13
-* Atomic: the filetree replication is atomic. At the end of a deployment, you are either booting from one deployment, or the other. There is no "partial deployed bootable image". If anything bad happens during replication or deployment- power loss, network failure, your machine boots from the old image. There is even a tool option to cleanup old deployed (successfully or not) image.
14
-* Manageable: You are provided simple tools to figure out exactly what packages have been installed, to compare files, configuration and package changes between versions.
15
-* Predictable, repeatable: A big headache for a system administrator is to maintain a farm of computers with different packages, files and configuration installed in different order, that will result in exponential set of test cases. With RPM-OStree, you get identical, predictable installed systems. 
16
-
17
-As drawbacks, I would mention:
18
-* Some applications configured by user on host may have compatibility issues if they save configuration or download into read only directories like /usr.
19
-* People not used with "read only" file systems will be disappointed that they could no longer use RPM, yum, tdnf to install whatever they want. Think of this as an "enterprise policy". They may circumvent this by customizing the target directory to a writable directory like /var or using rpm to install packages and record them using a new RPM repository in a writable place.
20
-* Administrators need to be aware about the directories re-mapping specific to OSTree and plan accordingly.
21
-
22
-## 1.3 Photon with RPM-OSTree installation profiles
23
-Photon takes advantage of RPM-OSTree and offers several installation choices:
24
-* Photon RPM-OSTree server - used to compose customized Photon OS installations and to prepare updates. I will call it for short 'server'.
25
-* Photon RPM-OSTree host connected to a default online server repository via http or https, maintained by VMware Photon OS team, where future updates will be published. This will create a minimal installation profile, but with the option to self-upgrade. I will call it for short 'default host'.
26
-* Photon RPM-OSTree host connected to a custom server repository. It requires a Photon RPM-OSTree Server installed in advance. I will call it for short 'custom host'.
27
-
28
-## 1.4 Terminology
29
-I use the term "OSTree" (starting with capitals) throughout this document, when I refer to the general use of this technology, the format of the repository or replication protocol. I use "RPM-OSTree" to emphasize the layer that adds RedHat Package Manager compatibility on both ends - at server and at host. However, since Photon OS is an RPM-based Linux, there are places in the documentation and even in the installer menus where "OSTree" may be used instead of "RPM-OSTree" when the distinction is not obvious or doesn't matter in that context.
30
-When "ostree" and "rpm-ostree" (in small letters) are encountered, they refer to the usage of the specific Unix commands.   
31
-
32
-Finally, "Photon RPM-OSTree" is the application or implementation of RPM-OStree system into Photon OS, materialized into two options: Photon Server and Photon Host (or client). "Server" or "Host" may be used with or without the "Photon" and/or "RPM-OStree" qualifier, but it means the same thing. 
33
-
34
-## 1.5 Sample code
35
-Codes samples used throughout the book are small commands that can be typed at shell command prompt and do not require downloading additional files. As an alternative, one can remote via ssh, so cut & paste sample code from outside sources or copy files via scp will work. See the Photon Administration guide to learn [how to enable ssh](photon-admin-guide.md#permitting-root-login-with-ssh). 
36
-The samples assume that the following VMs have been installed - see the steps in the next chapters:
37
-* A default host VM named **photon-host-def**.
38
-* Two server VMs named **photon-srv1** and **photon-srv2**.
39
-* Two custom host VMs named **photon-host-cus1** and **photon-host-cus2**, connected each to the corresponding server during install.
40
-
41
-## 1.6 How to read this book
42
-I've tried to structure this book to be used both as a sequential read and as a reference documentation.   
43
-If you are just interested in deploying a host system and keeping it up to date, then read chapters 2 and 5.   
44
-If you want to install your own server and experiment with customizing packages for your Photon hosts, then read chapters 6 to 9. There are references to the concepts discussed throughout the book, if you need to understand them better.  
45
-However, if you want to read page by page, information is presented from simple to complex, although as with any technical book, we occasionally run into the chicken and egg problem - forward references to concepts that have yet to be explained later. In other cases, concepts are introduced and presented in great detail that may be seem hard to follow at first, but I promise they will make sense in the later pages when you get to use them.
46
-
47
-## 1.7 Difference between versions
48
-This book has been written when Photon 1.0 was released, so all the information presented apply directly to Photon 1.0 and also to Photon 1.0 Revision 2 (in short Photon 1.0 Rev2 or Photon 1.0r, as some people refer to it as Photon 1.0 Refresh). This release is relevant to OSTree, because of ISO including an updated RPM-OSTree repository containing upgraded packages, as well as matching updated online repo that plays well into the upgrade story. Other than that, differences are minimal.  
49
-
50
-The guide has been updated significantly for Photon OS 2.0. Information of what's different is scattered through chapters 2, 6, 7, 8. [Install or rebase to Photon OS 2.0](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md) is dedicated to the topic.    
51
-
52
-OSTree technology is evolving too and rather than pointing out at what package version some feature has been introduced or changed, the focus is on the ostree and rpm-ostree package versions included with the Photon OS major releases.
53 1
deleted file mode 100644
... ...
@@ -1,89 +0,0 @@
1
-# Remotes
2
-
3
-In Chapter 3 we talked about the Refspec that contains a **photon:** prefix, that is the name of a remote. When a Photon host is installed, a remote is added - which contains the URL for an OSTree repository that is the origin of the commits we are going to pull from and deploy filetrees, in our case the Photon RPM-OSTree server we installed the host from. This remote is named **photon**, which may be confusing, because it's also the OS name and part of the Refspec (branch) path.
4
-
5
-## 10.1 Listing remotes
6
-A host repo can be configured to switch between multiple remotes to pull from, however only one remote is the "active" one at a time. We can list the remotes created so far, which brings back the expected result.
7
-```
8
-root@photon-host-def [ ~ ]# ostree remote list
9
-photon
10
-```
11
-We can inquiry about the URL for that remote name, which for the default host is the expected Photon OS online OSTree repo.
12
-```
13
-root@photon-host-def [ ~ ]# ostree remote show-url photon
14
-https://dl.bintray.com/vmware/photon/rpm-ostree/1.0
15
-```
16
-But where is this information stored? The repo's config file has it.
17
-```
18
-root@photon-host-def [ ~ ]# cat /ostree/repo/config 
19
-[core]
20
-repo_version=1
21
-mode=bare
22
-
23
-[remote "photon"]
24
-url=https://dl.bintray.com/vmware/photon/rpm-ostree/1.0
25
-gpg-verify=false
26
-```
27
-
28
-If same command is executed on the custom host we've installed, it's going to reveal the URL of the Photon RPM-OSTree server connected to during setup.
29
-```
30
-root@photon-host-cus [ ~ ]# ostree remote show-url photon
31
-http://10.118.101.168
32
-```
33
-
34
-## 10.2 GPG signature verification
35
-You may wonder what is the purpose of ```gpg-verify=false``` in the config file, associated with the specific remote. This will instruct any host update to skip the signing verification for the updates that come from server, resulted from tree composed locally at the server, as they are not signed. Without this, host updating will fail.  
36
-
37
-There is a whole chapter about signing, importing keys and so on that I will not get into, but the idea is that signing adds an extra layer of security, by validating that everything you download comes from the trusted publisher and has not been altered. That is the case for all Photon OS artifacts downloaded from VMware official site. All OVAs and packages, either from the online RPMS repositories or included in the ISO file - are signed by VMware. We've seen a similar setting ```gpgcheck=1``` in the RPMS repo configuration files that tdnf uses to validate or not the signature for all packages downloaded to be installed.
38
-
39
-
40
-## 10.3 Switching repositories
41
-Since mapping name/url is stored in the repo's config file, in principle you can re-assign a different URL, connecting the host to a different server. The next upgrade will get the latest commit chain from the new server.   
42
-If we edit photon-host-def's repo config and replace the bintray URL by photon-srv1's IP address, all original packages in the original 1.0_minimal version will be preserved, but any new package change (addition, removal, upgrade) added after that (in 1.0_minimal.1, 1.0_minimal.2) will be reverted and all new commits from photon-srv1 (that may have same version) will be applied. This is because the two repos are identical copies, so they have the same original commit ID as a common ancestor, but they diverge from there.  
43
-This may create confusion and it's one of the reasons I insisted on creating your own scheme of versioning.
44
-  
45
-If the old and new repo have nothing in common (no common ancestor commit), this will undo even the original commit, so all commits from the new tree will be applied.  
46
-A better solution would be to add a new remote that will identify where the commits come from.
47
-
48
-## 10.4 Adding and removing remotes
49
-
50
-A cleaner way to switch repositories is to add remotes that point to different servers. Let's add another server that we will refer to as **photon2**, along with (optional) the refspecs for branches that it provides (we will see later that in the newer OSTree versions, we don't need to know the branch names, they could be [queried at run-time](Photon-RPM-OSTree-10-Remotes.md#105-listing-available-branches)). The 'minimal' and 'full' branch ref names containing '2.0' suggest this may be a Photon OS 2.0 RPM-OSTree server. 
51
-```
52
-root@photon-host-cus [ ~ ]# ostree remote add --repo=/ostree/repo -v --no-gpg-verify photon2 http://10.118.101.86 photon/2.0/x86_64/minimal photon/2.0/x86_64/full
53
-root@photon-host-cus [ ~ ]# ostree remote list
54
-photon
55
-photon2
56
-root@photon-host-cus [ ~ ]# ostree remote show-url photon2
57
-http://10.118.101.86
58
-```
59
-Where is this information stored? There is an extra config file created per each remote:
60
-```
61
-root@photon-host-cus [ ~ ]# cat /etc/ostree/remotes.d/photon2.conf 
62
-[remote "photon2"]
63
-url=http://10.118.101.86
64
-branches=photon/2.0/x86_64/minimal;photon/2.0/x86_64/full;
65
-gpg-verify=false
66
-```
67
-You may have guessed what is the effect of ```--no-gpg-verify option```.  
68
-Obviously, remotes could also be deleted.
69
-```
70
-root@photon-host-cus [ ~ ]# ostree remote delete photon2
71
-root@photon-host-cus [ ~ ]# ostree remote list
72
-photon
73
-```
74
-
75
-## 10.5 List available branches
76
-If a host has been deployed from a specific branch and would like to switch to a different one, maybe from a different server, how would it know what branches are available? In git, you would run ```git remote show origin``` or ```git remote -a``` (although last command would not show all branches, unless you ran ```git fetch``` first).  
77
-
78
-Fortunately, in Photon OS 2.0 and higher, the hosts are able to query the server, if summary metadata has been generated, as we've seen in [8.5](Photon-RPM-OSTree:-8-File-oriented-server-operations.md#85-creating-summary-metadata).  This command lists all branches available for remote **photon2**.
79
-
80
-```
81
-root@photon-host-cus [ ~ ]# ostree remote refs photon2 
82
-photon2:photon/2.0/x86_64/base
83
-photon2:photon/2.0/x86_64/full
84
-photon2:photon/2.0/x86_64/minimal
85
-```
86
-
87
-###10.6 Switching branches (rebasing)
88
-
89
-
90 1
deleted file mode 100644
... ...
@@ -1,211 +0,0 @@
1
-# Running container applications between bootable images
2
-
3
-In this chapter, we want to test a docker application and make sure that all the settings and downloads done in one bootable filetree are going to be saved into writable folders and be available in the other image, in other words after reboot from the other image, everything is available exactly the same way.   
4
-We are going to do this twice: first, to verify an existing bootable image installed in parallel and then create a new one.
5
-
6
-## 11.1 Downloading a docker container appliance
7
-Photon OS comes with docker package installed and configured, but we expect that the docker daemon is inactive (not started). Configuration file /usr/lib/systemd/system/docker.service is read-only (remember /usr is bound as read-only). 
8
-```
9
-root@sample-host-def [ ~ ]# systemctl status docker
10
-* docker.service - Docker Daemon
11
-   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
12
-   Active: inactive (dead)
13
-
14
-root@sample-host-def [ ~ ]# cat /usr/lib/systemd/system/docker.service
15
-[Unit]
16
-Description=Docker Daemon
17
-Wants=network-online.target
18
-After=network-online.target
19
-
20
-[Service]
21
-ExecStart=/bin/docker -d -s overlay
22
-ExecReload=/bin/kill -HUP $MAINPID
23
-KillMode=process
24
-Restart=always
25
-MountFlags=slave
26
-LimitNOFILE=1048576
27
-LimitNPROC=1048576
28
-LimitCORE=infinity
29
-
30
-[Install]
31
-WantedBy=multi-user.target
32
-```
33
-Now let's enable docker daemon to start at boot time - this will create a symbolic link into writable folder /etc/systemd/system/multi-user.target.wants to its systemd configuration, as with all other systemd controlled services. 
34
-```
35
-root@sample-host-def [ ~ ]# systemctl enable docker
36
-Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
37
-
38
-root@sample-host-def [ ~ ]# ls -l /etc/systemd/system/multi-user.target.wants
39
-total 0
40
-lrwxrwxrwx 1 root root 38 Sep  6 08:38 docker.service -> /usr/lib/systemd/system/docker.service
41
-lrwxrwxrwx 1 root root 47 Aug 28 20:21 iptables.service -> ../../../../lib/systemd/system/iptables.service
42
-lrwxrwxrwx 1 root root 47 Aug 28 20:21 remote-fs.target -> ../../../../lib/systemd/system/remote-fs.target
43
-lrwxrwxrwx 1 root root 50 Aug 28 20:21 sshd-keygen.service -> ../../../../lib/systemd/system/sshd-keygen.service
44
-lrwxrwxrwx 1 root root 43 Aug 28 20:21 sshd.service -> ../../../../lib/systemd/system/sshd.service
45
-lrwxrwxrwx 1 root root 55 Aug 28 20:21 systemd-networkd.service -> ../../../../lib/systemd/system/systemd-networkd.service
46
-lrwxrwxrwx 1 root root 55 Aug 28 20:21 systemd-resolved.service -> ../../../../lib/systemd/system/systemd-resolved.service
47
-```
48
-To verify that the symbolic link points to a file in a read-only directory, try to make a change in this file using vim and save. you'll get an error: "/usr/lib/systemd/system/docker.service" E166: Can't open linked file for writing".  
49
-Finally, let's start the daemon, check again that is active. 
50
-```
51
-root@sample-host-def [ ~ ]# systemctl start docker
52
-
53
-root@sample-host-def [ ~ ]# systemctl status -l docker
54
-* docker.service - Docker Daemon
55
-   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
56
-   Active: active (running) since Sun 2015-09-06 08:56:30 UTC; 42s ago
57
- Main PID: 349 (docker)
58
-   CGroup: /system.slice/docker.service
59
-           `-349 /bin/docker -d -s overlay
60
-
61
-Sep 06 08:56:30 sample-host-def docker[349]: Warning: '-d' is deprecated, it will be removed soon. See usage.
62
-Sep 06 08:56:30 sample-host-def docker[349]: time="2015-09-06T08:56:30Z" level=warning msg="please use 'docker daemon' instead."
63
-Sep 06 08:56:30 sample-host-def docker[349]: time="2015-09-06T08:56:30.617969465Z" level=info msg="Option DefaultDriver: bridge"
64
-Sep 06 08:56:30 sample-host-def docker[349]: time="2015-09-06T08:56:30.618264109Z" level=info msg="Option DefaultNetwork: bridge"
65
-Sep 06 08:56:30 sample-host-def docker[349]: time="2015-09-06T08:56:30.632397533Z" level=info msg="Listening for HTTP on unix (/var/run/docker.sock)"
66
-Sep 06 08:56:30 sample-host-def docker[349]: time="2015-09-06T08:56:30.637516253Z" level=info msg="Firewalld running: false"
67
-Sep 06 08:56:30 sample-host-def docker[349]: time="2015-09-06T08:56:30.786748372Z" level=info msg="Loading containers: start."
68
-Sep 06 08:56:30 sample-host-def docker[349]: time="2015-09-06T08:56:30.787252697Z" level=info msg="Loading containers: done."
69
-Sep 06 08:56:30 sample-host-def docker[349]: time="2015-09-06T08:56:30.787410576Z" level=info msg="Daemon has completed initialization"
70
-Sep 06 08:56:30 sample-host-def docker[349]: time="2015-09-06T08:56:30.787610148Z" level=info msg="Docker daemon" commit=d12ea79 execdriver=native-0.2 graphdriver=overlay version=1.8.1
71
-```
72
-We'll ask docker to run Ubuntu Linux in a container. Since it's not present locally, it's going to be downloaded first from the official docker repository https://hub.docker.com/_/ubuntu/.
73
-```
74
-root@sample-host-def [ ~ ]# docker ps -a
75
-CONTAINER ID        IMAGE            COMMAND      CREATED           STATUS              PORTS       NAMES
76
-
77
-root@sample-host-def [ ~ ]# docker run -it ubuntu
78
-Unable to find image 'ubuntu:latest' locally
79
-latest: Pulling from library/ubuntu
80
-d3a1f33e8a5a: Downloading [=========================================>         ] 54.55 MB/65.79 MB
81
-c22013c84729: Download complete 
82
-d74508fb6632: Download complete 
83
-91e54dfb1179: Download complete 
84
-```
85
-When downloading is complete, it comes to Ubuntu root prompt with assigned host name d07ebca78051, that is actually the Container ID. Let's verify it's indeed the expected OS.
86
-```
87
-root@sample-host-def [ ~ ]# docker run -it ubuntu
88
-Unable to find image 'ubuntu:latest' locally
89
-latest: Pulling from library/ubuntu
90
-d3a1f33e8a5a: Pull complete 
91
-c22013c84729: Pull complete 
92
-d74508fb6632: Pull complete 
93
-91e54dfb1179: Already exists 
94
-library/ubuntu:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
95
-Digest: sha256:fde8a8814702c18bb1f39b3bd91a2f82a8e428b1b4e39d1963c5d14418da8fba
96
-Status: Downloaded newer image for ubuntu:latest
97
-
98
-root@d07ebca78051:/# cat /etc/os-release
99
-NAME="Ubuntu"
100
-VERSION="14.04.3 LTS, Trusty Tahr"
101
-ID=ubuntu
102
-ID_LIKE=debian
103
-PRETTY_NAME="Ubuntu 14.04.3 LTS"
104
-VERSION_ID="14.04"
105
-HOME_URL="http://www.ubuntu.com/"
106
-SUPPORT_URL="http://help.ubuntu.com/"
107
-BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
108
-root@d07ebca78051:/#
109
-```
110
-Now let's write a file into Ubuntu home directory
111
-```
112
-echo "Ubuntu file" > /home/myfile
113
-root@d07ebca78051:/home# cat /home/myfile
114
-Ubuntu file
115
-```
116
-We'll exit back to the Photon prompt and if it's stopped, we will re-start it.
117
-```
118
-root@d07ebca78051:/# exit
119
-exit
120
-
121
-root@sample-host-def [ ~ ]# docker ps -a
122
-CONTAINER ID    IMAGE   COMMAND       CREATED         STATUS                      PORTS   NAMES
123
-d07ebca78051    ubuntu  "/bin/bash"   3 minutes ago   Exited (0) 13 seconds ago           kickass_hodgkin
124
-
125
-root@photon-host-cus1 [ ~ ]# docker start  d07ebca78051
126
-d07ebca78051
127
-
128
-root@photon-host-cus1 [ ~ ]# docker ps -a
129
-CONTAINER ID    IMAGE   COMMAND       CREATED         STATUS                      PORTS   NAMES
130
-d07ebca78051    ubuntu  "/bin/bash"   16 minutes ago  Up 5 seconds                        kickass_hodgkin
131
-```
132
-
133
-## 11.2 Rebooting into an existing image
134
-Now let's reboot the machine and select the other image. First, we'll verify that the docker daemon is automaically started.
135
-```
136
-root@photon-host-cus1 [ ~ ]# systemctl status docker
137
-* docker.service - Docker Daemon
138
-   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
139
-   Active: active (running) since Sun 2015-09-06 11:19:05 UTC; 2min 9s ago
140
- Main PID: 292 (docker)
141
-   CGroup: /system.slice/docker.service
142
-           `-292 /bin/docker -d -s overlay
143
-   ...
144
-```
145
-Next, is the Ubuntu OS container still there?
146
-```
147
-root@photon-host-cus1 [ ~ ]# docker ps -a 
148
-CONTAINER ID    IMAGE     COMMAND      CREATED          STATUS                     PORTS   NAMES
149
-57dcac5d0490    ubuntu    "/bin/bash"  25 minutes ago   Exited (137) 5 minutes ago         sad_banach
150
-```
151
-It is, so let's start it, attach and verify that our file is persisted, then add another line to it and save, exit.
152
-```
153
-root@photon-host-cus1 [ ~ ]# docker start -i  57dcac5d0490
154
-root@57dcac5d0490:/# cat /home/myfile 
155
-Ubuntu file
156
-root@57dcac5d0490:/# echo "booted into existing image" >> /home/myfile
157
-root@57dcac5d0490:/# exit
158
-```
159
-## 11.3 Reboot into a newly created image
160
-Let's upgrade and replace the .0 image by a .3 build that contains git and also perl_YAML (because it is a dependency of git).
161
-```
162
-root@photon-host-cus1 [ ~ ]# rpm-ostree status
163
-  TIMESTAMP (UTC)         VERSION               ID             OSNAME     REFSPEC                              
164
-* 2015-09-04 00:36:37     1.0_tp2_minimal.2     092e21d292     photon     photon:photon/tp2/x86_64/minimal     
165
-  2015-08-20 22:27:43     1.0_tp2_minimal       2940e10c4d     photon     photon:photon/tp2/x86_64/minimal     
166
-
167
-root@photon-host-cus1 [ ~ ]# rpm-ostree upgrade
168
-Updating from: photon:photon/tp2/x86_64/minimal
169
-
170
-43 metadata, 209 content objects fetched; 19992 KiB transferred in 0 seconds
171
-Copying /etc changes: 5 modified, 0 removed, 19 added
172
-Transaction complete; bootconfig swap: yes deployment count change: 0
173
-Freed objects: 16.2 MB
174
-Added:
175
-  git-2.1.2-1.ph1tp2.x86_64
176
-  perl-YAML-1.14-1.ph1tp2.noarch
177
-Upgrade prepared for next boot; run "systemctl reboot" to start a reboot
178
-
179
-root@photon-host-cus1 [ ~ ]# rpm-ostree status
180
-  TIMESTAMP (UTC)         VERSION               ID             OSNAME     REFSPEC                              
181
-  2015-09-06 18:12:08     1.0_tp2_minimal.3     d16aebd803     photon     photon:photon/tp2/x86_64/minimal     
182
-* 2015-09-04 00:36:37     1.0_tp2_minimal.2     092e21d292     photon     photon:photon/tp2/x86_64/minimal  
183
-```
184
-After reboot from 1.0_tp2_minimal.3 build, let's check that the 3-way /etc merge succeeded as expected. The docker.service slink is still there, and docker demon restarted at boot.
185
-```
186
-root@photon-host-cus1 [ ~ ]# ls -l /etc/systemd/system/multi-user.target.wants/docker.service 
187
-lrwxrwxrwx 1 root root 38 Sep  6 12:50 /etc/systemd/system/multi-user.target.wants/docker.service -> /usr/lib/systemd/system/docker.service
188
-
189
-root@photon-host-cus1 [ ~ ]# systemctl status docker
190
-* docker.service - Docker Daemon
191
-   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
192
-   Active: active (running) since Sun 2015-09-06 12:56:33 UTC; 1min 27s ago
193
- Main PID: 292 (docker)
194
-   CGroup: /system.slice/docker.service
195
-           `-292 /bin/docker -d -s overlay
196
-
197
-   ...   
198
-```  
199
-Let's revisit the Ubuntu container. Is the container still there? is myfile persisted?
200
-```
201
-root@photon-host-cus1 [ ~ ]# docker ps -a
202
-CONTAINER ID   IMAGE       COMMAND      CREATED       STATUS                        PORTS   NAMES
203
-57dcac5d0490   ubuntu      "/bin/bash"  2 hours ago   Exited (0) About an hour ago          sad_banach
204
-
205
-root@photon-host-cus1 [ ~ ]# docker start 57dcac5d0490
206
-
207
-root@57dcac5d0490:/# cat /home/myfile
208
-Ubuntu file
209
-booted into existing image
210
-root@57dcac5d0490:/# echo "booted into new image" >> /home/myfile
211
-```
212 1
deleted file mode 100644
... ...
@@ -1,38 +0,0 @@
1
-# Installing a host against default server repository
2
-
3
-RPM-OSTree Host default server repo installation option in Photon 1.0 or 1.0 Revision 2 will setup a profile similar to Photon Minimal, with the added benefit of being able to self-upgrade.  
4
-Photon OS 2.0 does not offer a 'default host' installation. See chapter 7 and 12 for other options. 
5
-
6
-## 2.1 Who is this for?  
7
-The RPM-OSTree 'default host' is the easiest way to deploy a Photon RPM-OSTree host from ISO/cdrom, without the need to deploy and maintain an RPM-OSTree server. It is targeted at the user who relies on VMware Photon OS team to keep his or her system up-to-date, configured to get its updates from the official Photon 1.0 OSTree repository.
8
-
9
-This is also the fastest way to install a host (18 seconds on my Mac with SSD after all UI choices have been entered by user), as we've included in the ISO/cdrom an identical copy of the Photon 1.0 "starter" RPM-OSTree repository that is published online by VMware Photon OS team. So rather than pulling from the online repository, the installer pulls the repo from cdrom, which saves bandwidth and also reduces to zero the chances of failing due to a networking problem. After successful installation, any updates are going to be pulled from the official online repository, when Photon OS team will make them available.    
10
-
11
-Note: It is also possible to install an RPM-OSTree host against the official online repo via PXE boot, without the benefit of fast, local pull from cdrom. This will be covered in the PXE boot/kickstart chapter, as it requires additional configuration.
12
-
13
-## 2.2 Installing the ISO, step by step
14
-User will first download [Photon 1.0 ISO file](https://bintray.com/artifact/download/vmware/photon/photon-1.0-13c08b6.iso) or the newer [Photon 1.0 Rev2 ISO file](https://bintray.com/artifact/download/vmware/photon/photon-1.0-62c543d.iso) that contains the installer, which is able to deploy any of the supported Photon installation profiles.
15
-
16
-There are some steps common to all Photon installation profiles, starting with adding a VM in VMware Fusion, Workstation or ESXi, selecting the OS family, then customizing for disk size, CPU, memory size, network interface etc. (or leaving the defaults) and selecting the ISO image as cdrom. The installer will launch, that will go through disk partitioning and accepting the license agreement screens, followed by selecting an installation profile.
17
-These steps are described at the page linked below, so I won't repeat them, just that instead of setting up a Photon Minimal profile, we will install a Photon OSTree host:   
18
-
19
-[Running Project Photon on Fusion](Running-Project-Photon-on-Fusion.md).  
20
-
21
-Select the **Photon OSTree Host** option.
22
-
23
-![PhotonChooseHost](https://cloud.githubusercontent.com/assets/13158414/14757883/15742dce-08ad-11e6-9486-4fe08b4bf7f2.png)  
24
-
25
-Continue with setting up a host name like **photon1-def** and a root password, re-confirm.   
26
-Then, select "Default OSTree Server" and continue.  
27
-
28
-![PhotonChooseHostDefault](https://cloud.githubusercontent.com/assets/13158414/14757878/1557500a-08ad-11e6-9cb7-f917cb0fdaca.png)
29
-
30
-![PhotonHostDefaultFinish](https://cloud.githubusercontent.com/assets/13158414/14757882/1571cde0-08ad-11e6-8e07-47258ca4e8d9.png)  
31
-
32
-When installation is over, the VM will reboot and will show in grub VMWare Photon/Linux 1.0_minimal (ostree), which will reassure that it's booting from an OSTree image!  
33
-
34
-![PhotonHostFirstRebootGrub](https://cloud.githubusercontent.com/assets/13158414/14757877/155614ec-08ad-11e6-9e36-b43f77b6fb69.png)  
35
-
36
-Boot, login and you are ready to use it!  The next chapters are about experimenting first hand and understanding in detail how everything works. If you just want to learn how to [upgrade your host](Photon-RPM-OSTree-5-Host-updating-operations.md) when new updates are available, skip to [Host updating operations](Photon-RPM-OSTree-5-Host-updating-operations.md).
37
-
38
-Note: If you ran Photon 1.0 Rev2 installer rather than Photon 1.0, you may notice in grub **1.0_minimal.1** rather than **1.0_minimal**, hinting of an updated, newer version installed. This will be also explained in [Host updating operations](Photon-RPM-OSTree-5-Host-updating-operations.md).  
39 1
deleted file mode 100644
... ...
@@ -1,256 +0,0 @@
1
-# Querying For Commit File and Package Metadata
2
-
3
-There are several ostree and rpm-ostree commands that list file or package data based on either the Commit ID, or Refspec. If Refspec is passed as a parameter, it's the same as passing the most recent commit ID (head) for that branch.
4
-
5
-## 4.1 Commit history
6
-For a host that is freshly installed, there is only one commit in the history for the only branch.
7
-```
8
-root@photon-host [ ~ ]# ostree log photon/1.0/x86_64/minimal
9
-commit 56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4
10
-Date:  2016-06-07 14:06:17 +0000
11
-Version: 1.0_minimal
12
-```
13
-This commit has no parent; if there was an older commit, it would have been listed too. We can get the same listing (either nicely formatted or raw variant data) by passing the Commit ID. Just the first several hex digits will suffice to identify the commit ID. We can either request to be displayed in a pretty format, or raw - the actual C struct.
14
-```
15
-root@photon-host [ ~ ]# ostree log 56ef
16
-commit 56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4
17
-Date:  2016-06-07 14:06:17 +0000
18
-Version: 1.0_minimal
19
-```
20
-```
21
-root@photon-host [ ~ ]# ostree log 56ef --raw
22
-commit 56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4
23
-({'version': <'1.0_minimal'>, 'rpmostree.inputhash': <'40ae75453cf7f00b163848676c4b5716511e7515b95fb7b9168004aa97f05dd9'>}, @ay [], @a(say) [], '', '', uint64 1465308377, [byte 0x3c, 0x6b, 0x71, 0x44, 0x07, 0xd0, 0x5e, 0xd5, 0x9d, 0xfc, 0x4a, 0x1c, 0x33, 0x74, 0x96, 0x1d, 0x50, 0xa3, 0x53, 0xd5, 0xf1, 0x20, 0xb4, 0x40, 0xd0, 0x60, 0x35, 0xf2, 0xf8, 0x29, 0xcf, 0x5f], [byte 0x44, 0x6a, 0x0e, 0xf1, 0x1b, 0x7c, 0xc1, 0x67, 0xf3, 0xb6, 0x03, 0xe5, 0x85, 0xc7, 0xee, 0xee, 0xb6, 0x75, 0xfa, 0xa4, 0x12, 0xd5, 0xec, 0x73, 0xf6, 0x29, 0x88, 0xeb, 0x0b, 0x6c, 0x54, 0x88])
24
-```
25
-
26
-## 4.2 Listing file mappings
27
-This command lists the file relations between the original source Linux Photon filetree and the deployed filetree. The normal columns include file type type (regular file, directory, link), permissions in chmod octal format, userID, groupID, file size, file name. 
28
-```
29
-root@photon-host [ ~ ]# ostree ls photon/1.0/x86_64/minimal
30
-d00755 0 0      0 /
31
-l00777 0 0      0 /bin -> usr/bin
32
-l00777 0 0      0 /home -> var/home
33
-l00777 0 0      0 /lib -> usr/lib
34
-l00777 0 0      0 /lib64 -> usr/lib
35
-l00777 0 0      0 /media -> run/media
36
-l00777 0 0      0 /mnt -> var/mnt
37
-l00777 0 0      0 /opt -> var/opt
38
-l00777 0 0      0 /ostree -> sysroot/ostree
39
-l00777 0 0      0 /root -> var/roothome
40
-l00777 0 0      0 /sbin -> usr/sbin
41
-l00777 0 0      0 /srv -> var/srv
42
-l00777 0 0      0 /tmp -> sysroot/tmp
43
-d00755 0 0      0 /boot
44
-d00755 0 0      0 /dev
45
-d00755 0 0      0 /proc
46
-d00755 0 0      0 /run
47
-d00755 0 0      0 /sys
48
-d00755 0 0      0 /sysroot
49
-d00755 0 0      0 /usr
50
-d00755 0 0      0 /var
51
-```
52
-Extra columns can be added like checksum (-C) and extended attributes (-X). 
53
-```
54
-root@photon-host [ /usr/share/man/man1 ]# ostree ls photon/1.0/x86_64/minimal -C
55
-d00755 0 0      0 3c6b714407d05ed59dfc4a1c3374961d50a353d5f120b440d06035f2f829cf5f 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /
56
-l00777 0 0      0 389846c2702216e1367c8dfb68326a6b93ccf5703c89c93979052a9bf359608e /bin -> usr/bin
57
-l00777 0 0      0 4344c10bf4931483f918496534f12ed9b50dc6a2cead35e3cd9dd898d6ac9414 /home -> var/home
58
-l00777 0 0      0 f11902ca9d69a80df33918534a3e443251fd0aa7f94b76301e1f55e52aed29dd /lib -> usr/lib
59
-l00777 0 0      0 f11902ca9d69a80df33918534a3e443251fd0aa7f94b76301e1f55e52aed29dd /lib64 -> usr/lib
60
-l00777 0 0      0 75317a3df11447c470ffdd63dde045450ca97dfb2a97a0f3f6a21a5da66f737c /media -> run/media
61
-l00777 0 0      0 97c55dbe24e8f3aecfd3f3e5b3f44646fccbb39799807d37a217e9c871da108b /mnt -> var/mnt
62
-l00777 0 0      0 46b1abbd27a846a9257a8d8c9fc4b384ac0888bdb8ac0d6a2d5de72715bd5092 /opt -> var/opt
63
-l00777 0 0      0 d37269e3f46023fd0275212473e07011894cdf4148cbf3fb5758a7e9471dad8e /ostree -> sysroot/ostree
64
-l00777 0 0      0 6f800e74eed172661278d1e1f09e389a6504dcd3358618e1c1618f91f9d33601 /root -> var/roothome
65
-l00777 0 0      0 e0bead7be9323b06bea05cb9b66eb151839989e3a4e5d1a93e09a36919e91818 /sbin -> usr/sbin
66
-l00777 0 0      0 5d4250bba1ed300f793fa9769474351ee5cebd71e8339078af7ebfbe6256d9b5 /srv -> var/srv
67
-l00777 0 0      0 364fbd62f91ca1e06eb7dbd50c93de8976f2cea633658e2dbe803ce6f7490c09 /tmp -> sysroot/tmp
68
-d00755 0 0      0 1e4f98d92b35c453d8f61e668aea9fae7ca1863f6609db787374b4ad5caf3b2f 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /boot
69
-d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /dev
70
-d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /proc
71
-d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /run
72
-d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /sys
73
-d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /sysroot
74
-d00755 0 0      0 b072f4b3e995a491c04d88636401ca156e80f103b002d724ae76c07174ee4c74 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /usr
75
-d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /var
76
-```
77
-
78
-By default, only the top folders are listed, but -R will list recursively. Instead of listing over 10,000 files, let's filter to just all files that contain 'rpm-ostree', 'rpmostree' or 'RpmOstree', that must belong to **rpm-ostree** package itself.
79
-```
80
-root@photon-host [ /usr/share/rpm-ostree ]# ostree ls photon/1.0/x86_64/minimal -R | grep -e '[Rr]pm-\?[Oo]stree'
81
-l00777 0 0      0 /usr/bin/atomic -> rpm-ostree
82
--00755 0 0 131104 /usr/bin/rpm-ostree
83
-l00777 0 0      0 /usr/lib/librpmostree-1.so.1 -> librpmostree-1.so.1.0.0
84
--00755 0 0 104272 /usr/lib/librpmostree-1.so.1.0.0
85
--00644 0 0   1296 /usr/lib/girepository-1.0/RpmOstree-1.0.typelib
86
-d00755 0 0      0 /usr/lib/rpm-ostree
87
--00644 0 0    622 /usr/lib/rpm-ostree/tmpfiles-ostree-integration.conf
88
--00644 0 0    717 /usr/lib/tmpfiles.d/rpm-ostree-autovar.conf
89
-d00755 0 0      0 /usr/share/rpm-ostree
90
--00644 0 0   1132 /usr/share/rpm-ostree/treefile.json
91
-```
92
-
93
-**atomic** is really an alias for rpm-ostree command. The last file **treefile.json** is not installed by the rpm-ostree package, it's actually downloaded from the server, as we will see in the next chapter. For now, let's notice **"osname" : "photon",  "ref" : "photon/1.0/x86_64/minimal",  "automatic_version_prefix" : "1.0_minimal"**, that matches what we've known so far, and also the **"documentation" : false** setting, that explains why there are no manual files installed for rpm-ostree, and in fact for any package.
94
-```
95
-root@photon-host [ /usr/share/rpm-ostree ]# ls -l /usr/share/man/man1 
96
-total 0
97
-```
98
-
99
-
100
-## 4.3 Listing configuration changes
101
-
102
-To diff the current /etc configuration versus default /etc (from the base image), this command will show the **M**odified, **A**dded and **D**eleted files:
103
-```
104
-root@photon-host [ ~ ]# ostree admin config-diff
105
-M    mtab
106
-M    ssh/sshd_config
107
-M    shadow
108
-M    hosts
109
-M    fstab
110
-M    machine-id
111
-A    ssh/ssh_host_rsa_key
112
-A    ssh/ssh_host_rsa_key.pub
113
-A    ssh/ssh_host_dsa_key
114
-A    ssh/ssh_host_dsa_key.pub
115
-A    ssh/ssh_host_ecdsa_key
116
-A    ssh/ssh_host_ecdsa_key.pub
117
-A    ssh/ssh_host_ed25519_key
118
-A    ssh/ssh_host_ed25519_key.pub
119
-A    ssh/sshd.pid
120
-A    tmpfiles.d/postinstall.sh
121
-A    udev/hwdb.bin
122
-A    resolv.conf
123
-A    hostname
124
-A    postinstall
125
-A    localtime
126
-A    .updated
127
-```
128
-
129
-## 4.4 Listing packages
130
-As expected, there is an rpm-ostree command that lists all the packages for that branch, extracted from RPM database.   
131
-```
132
-root@photon-host [ ~ ]# rpm-ostree db list photon/1.0/x86_64/minimal
133
-ostree commit: photon/1.0/x86_64/minimal (56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4)
134
- Linux-PAM-1.2.1-3.ph1.x86_64
135
- attr-2.4.47-3.ph1.x86_64
136
- autogen-libopts-5.18.7-2.ph1.x86_64
137
- bash-4.3.30-4.ph1.x86_64
138
- bc-1.06.95-3.ph1.x86_64
139
- binutils-2.25.1-2.ph1.x86_64
140
- bridge-utils-1.5-2.ph1.x86_64
141
- bzip2-1.0.6-5.ph1.x86_64
142
- ca-certificates-20160109-5.ph1.x86_64
143
- coreutils-8.25-2.ph1.x86_64
144
- cpio-2.12-2.ph1.x86_64
145
- cracklib-2.9.6-2.ph1.x86_64
146
- cracklib-dicts-2.9.6-2.ph1.x86_64
147
- curl-7.47.1-2.ph1.x86_64
148
- db-6.1.26-2.ph1.x86_64
149
- dbus-1.8.8-5.ph1.x86_64
150
- device-mapper-2.02.141-5.ph1.x86_64
151
- device-mapper-libs-2.02.141-5.ph1.x86_64
152
- docker-1.11.0-5.ph1.x86_64
153
- dracut-044-3.ph1.x86_64
154
- dracut-tools-044-3.ph1.x86_64
155
- e2fsprogs-1.42.13-2.ph1.x86_64
156
- elfutils-libelf-0.165-2.ph1.x86_64
157
- expat-2.1.0-2.ph1.x86_64
158
- file-5.24-2.ph1.x86_64
159
- filesystem-1.0-7.ph1.x86_64
160
- findutils-4.6.0-2.ph1.x86_64
161
- flex-2.5.39-2.ph1.x86_64
162
- gdbm-1.11-2.ph1.x86_64
163
- glib-2.47.6-2.ph1.x86_64
164
- glib-networking-2.46.1-2.ph1.x86_64
165
- glibc-2.22-8.ph1.x86_64
166
- gmp-6.0.0a-3.ph1.x86_64
167
- gnutls-3.4.11-2.ph1.x86_64
168
- gobject-introspection-1.46.0-2.ph1.x86_64
169
- gpgme-1.6.0-2.ph1.x86_64
170
- grep-2.21-2.ph1.x86_64
171
- grub2-2.02-4.ph1.x86_64
172
- gzip-1.6-2.ph1.x86_64
173
- hawkey-2014.1-4.ph1.x86_64
174
- iana-etc-2.30-2.ph1.noarch
175
- iproute2-4.2.0-2.ph1.x86_64
176
- iptables-1.6.0-4.ph1.x86_64
177
- iputils-20151218-3.ph1.x86_64
178
- json-glib-1.0.4-2.ph1.x86_64
179
- kmod-21-4.ph1.x86_64
180
- krb5-1.14-4.ph1.x86_64
181
- libarchive-3.1.2-6.ph1.x86_64
182
- libassuan-2.4.2-2.ph1.x86_64
183
- libcap-2.25-2.ph1.x86_64
184
- libffi-3.2.1-2.ph1.x86_64
185
- libgcc-5.3.0-3.ph1.x86_64
186
- libgcrypt-1.6.5-2.ph1.x86_64
187
- libgomp-5.3.0-3.ph1.x86_64
188
- libgpg-error-1.21-2.ph1.x86_64
189
- libgsystem-2015.1-2.ph1.x86_64
190
- libhif-0.2.2-2.ph1.x86_64
191
- librepo-1.7.17-2.ph1.x86_64
192
- libselinux-2.5-2.ph1.x86_64
193
- libsepol-2.5-2.ph1.x86_64
194
- libsolv-0.6.19-2.ph1.x86_64
195
- libsoup-2.53.90-2.ph1.x86_64
196
- libstdc++-5.3.0-3.ph1.x86_64
197
- libtasn1-4.7-2.ph1.x86_64
198
- libtool-2.4.6-2.ph1.x86_64
199
- libxml2-2.9.4-1.ph1.x86_64
200
- linux-4.4.8-6.ph1.x86_64
201
- lua-5.3.2-2.ph1.x86_64
202
- m4-1.4.17-2.ph1.x86_64
203
- mkinitcpio-19-2.ph1.x86_64
204
- mpfr-3.1.3-2.ph1.x86_64
205
- ncurses-6.0-2.ph1.x86_64
206
- net-tools-1.60-7.ph1.x86_64
207
- nettle-3.2-2.ph1.x86_64
208
- nspr-4.12-2.ph1.x86_64
209
- nss-3.21-2.ph1.x86_64
210
- nss-altfiles-2.19.1-2.ph1.x86_64
211
- openssh-7.1p2-3.ph1.x86_64
212
- openssl-1.0.2h-2.ph1.x86_64
213
- ostree-2015.7-5.ph1.x86_64
214
- pcre-8.38-3.ph1.x86_64
215
- photon-release-1.0-5.ph1.noarch
216
- pkg-config-0.28-2.ph1.x86_64
217
- popt-1.16-2.ph1.x86_64
218
- procps-ng-3.3.11-2.ph1.x86_64
219
- python2-2.7.11-4.ph1.x86_64
220
- python2-libs-2.7.11-4.ph1.x86_64
221
- readline-6.3-4.ph1.x86_64
222
- rpm-4.11.2-10.ph1.x86_64
223
- rpm-ostree-2015.7-2.ph1.x86_64
224
- sed-4.2.2-2.ph1.x86_64
225
- shadow-4.2.1-7.ph1.x86_64
226
- sqlite-autoconf-3.11.0-2.ph1.x86_64
227
- systemd-228-21.ph1.x86_64
228
- tcsh-6.19.00-4.ph1.x86_64
229
- util-linux-2.27.1-2.ph1.x86_64
230
- vim-7.4-5.ph1.x86_64
231
- which-2.21-2.ph1.x86_64
232
- xz-5.2.2-2.ph1.x86_64
233
- zlib-1.2.8-3.ph1.x86_64
234
-```
235
-
236
-## 4.5 Querying for package details
237
-We are able to use the query option of rpm to make sure any package have been installed properly. The files list should match the previous file mappings in 4.2, so let's check package **rpm-ostree**. As we've seen, manual files listed here are actually missing, they were not installed.
238
-```
239
-root@photon-host [ /usr/share/man/man1 ]# rpm -ql  rpm-ostree
240
-/usr/bin/atomic
241
-/usr/bin/rpm-ostree
242
-/usr/lib/girepository-1.0/RpmOstree-1.0.typelib
243
-/usr/lib/librpmostree-1.so.1
244
-/usr/lib/librpmostree-1.so.1.0.0
245
-/usr/lib/rpm-ostree
246
-/usr/lib/rpm-ostree/tmpfiles-ostree-integration.conf
247
-/usr/share/man/man1/atomic.1.gz
248
-/usr/share/man/man1/rpm-ostree.1.gz
249
-```
250
-## 4.6 Why am I unable to install, update or delete packages?
251
-
252
-All the commands executed so far operated in read-only mode. But what if you want to erase or install a package using our old friend rpm?
253
-The RPM database is not writable any longer and the file system itself is read-only (except for /var and /etc directories). The idea is that preparing the packages should be done via server tree composition and deployment at host should bring them installed into a new bootable tree that is read-only, recorded into the read-only RPM database. This will insure that all systems deployed are brought into a predictable state and no one could mess with them.
254
-In fact, tdnf and yum commands are not even available to install new packages at the host. Even if you bring them over, adding a new package via **tdnf install** will return an error.
255
-But don't get sad. Installing, updating and deleting files & packages the RPM-OSTree way - from the server - that's exactly the topic of next chapters.
256
-
257 1
deleted file mode 100644
... ...
@@ -1,506 +0,0 @@
1
-# Host Updating Operations 
2
-
3
-## 5.1 Is it an update or an upgrade? 
4
-If you've used yum, dnf (and now tdnf for Photon) in RPM systems or apt-get in Debian based Unix, you understand what "install" is for packages and the subtle difference between "update" and "upgrade".
5
-
6
-OSTree and RPM-OSTree don't distringuish between them and the term "upgrade" has a slightly different meaning - to bring the system in sync with the remote repo, to the top of the Refspec (branch), just like in Git, by pulling the latest changes.
7
-
8
-In fact, ostree and rpm-ostree commands support a single "upgrade" verb for a file image tree and a package list in the same refspec (branch). ```rpm-ostree upgrade``` will install a package if it doesn't exist, will not touch it if it has same version in the new image, will upgrade it if the version number is higher and it may actually downgrade it, if the package has been downgraded in the new image. I wish this operation had a different name, to avoid any confusion.
9
-
10
-The reverse operation of an upgrade is a "rollback" and fortunately it's not named "downgrade" because it may upgrade packages in the last case describe above.
11
-
12
-As we'll see in a future chapter, a jump to a different Refspec (branch) is also supported and it's named "rebase".
13
-
14
-
15
-## 5.2 Incremental upgrade 
16
-To check if there are any updates available, one would execute:
17
-```
18
-root@photon-host-def [ ~ ]# rpm-ostree upgrade
19
-Updating from: photon:photon/1.0/x86_64/minimal
20
-
21
-
22
-No upgrade available.
23
-```  
24
-It's good idea to check periodically for updates. In fact, VMware released in July 2016 Photon OS 1.0 Revision 2, that included an ISO containing an updated OSTree repo, mirrored online at same bintray site location. The updated OSTree repo contains new versions all packages that have been updated between since the 1.0 GA (general availability) in September 2015.  
25
-
26
-To simplify our example, let's assume that an updated Photon OS release for this branch (Refspec) contains three new packages: **gawk**, **sudo** and **wget**.
27
-To check if there are any new updates without actually applying them, we will pass the --check-diff flag, that would list the different packages as added, modified or deleted - if such operations were to happen.
28
-```
29
-root@photon-host [ ~ ]# rpm-ostree upgrade --check-diff
30
-Updating from: photon:photon/1.0/x86_64/minimal
31
-
32
-8 metadata, 13 content objects fetched; 1026 KiB transferred in 0 seconds
33
-+gawk-4.1.3-2.ph1.x86_64
34
-+sudo-1.8.15-3.ph1.x86_64
35
-+wget-1.17.1-2.ph1.x86_64
36
-```
37
-
38
-We like what we see and now let's upgrade for real. This command will deploy a new bootable filetree. 
39
-```
40
-root@photon-host [ ~ ]# rpm-ostree upgrade             
41
-Updating from: photon:photon/1.0/x86_64/minimal
42
-
43
-98 metadata, 189 content objects fetched; 14418 KiB transferred in 0 seconds
44
-Copying /etc changes: 6 modified, 0 removed, 16 added
45
-Transaction complete; bootconfig swap: yes deployment count change: 1
46
-Added:
47
-  gawk-4.1.3-2.ph1.x86_64
48
-  sudo-1.8.15-3.ph1.x86_64
49
-  wget-1.17.1-2.ph1.x86_64
50
-Upgrade prepared for next boot; run "systemctl reboot" to start a reboot
51
-```
52
-By looking at the commit history, notice that the new commit has the original commit as parent. 
53
-```
54
-root@photon-host [ ~ ]# ostree log photon/1.0/x86_64/minimal
55
-commit 184d9bbcecd4e8401d4a5073a248082f7a8888d232ef9678b6942002547a14e3
56
-Date:  2016-06-13 22:23:25 +0000
57
-Version: 1.0_minimal.1
58
-
59
-
60
-commit 56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4
61
-Date:  2016-06-07 14:06:17 +0000
62
-Version: 1.0_minimal 
63
-```
64
-
65
-Notice that now we have a new reference, that corresponds to the newly deployed image.
66
-```
67
-root@photon-host [ ~ ]# ostree refs
68
-ostree/1/1/0
69
-ostree/1/1/1
70
-photon:photon/1.0/x86_64/minimal
71
-```
72
-
73
-Let's look at the status. The new filetree version .1 has the expected Commit ID and a newer timestamp, that is actually the server date/time when the image has been generated, not the time/date when it was downloaded or installed at the host. The old image has a star next to it, showing that's the image the system is booted currently into. 
74
-```
75
-root@photon-host [ ~ ]# rpm-ostree status
76
-  TIMESTAMP (UTC)        VERSION          ID            OSNAME    REFSPEC                              
77
-  2016-06-13 22:23:25    1.0_minimal.1    184d9bbcec    photon    photon:photon/1.0/x86_64/minimal     
78
-* 2016-06-07 14:06:17    1.0_minimal      56ef687f13    photon    photon:photon/1.0/x86_64/minimal     
79
-```
80
-
81
-Now let's type 'reboot'. Grub will list the new filetree as the first image, marked with a star, as the default bootable image. If the keyboard is not touched and order is not changed, grub will timeout and will boot into that image.
82
-
83
-![Grub-dual-boot-1-0](https://cloud.githubusercontent.com/assets/13158414/16056451/68275a40-322a-11e6-8289-b1c82d617a9c.png)
84
-
85
-Let's look again at the status. It's identical, just that the star is next to the newer image, to show it's the current image it has booted from.
86
-```
87
-root@photon-host [ ~ ]# rpm-ostree status
88
-  TIMESTAMP (UTC)        VERSION          ID            OSNAME    REFSPEC                              
89
-* 2016-06-13 22:23:25    1.0_minimal.1    184d9bbcec    photon    photon:photon/1.0/x86_64/minimal     
90
-  2016-06-07 14:06:17    1.0_minimal      56ef687f13    photon    photon:photon/1.0/x86_64/minimal         
91
-```
92
-
93
-Also, the current deployment directory is based on the new 82bca commit:
94
-```
95
-root@photon-host-def [ ~ ]# ostree admin config-diff --print-current-dir
96
-/ostree/deploy/photon/deploy/82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817.0
97
-```
98
-A fresh upgrade for a new version will delete the older, original image and bring a new one, that will become the new default image. The previous 'default' image will move down one position as the backup image.
99
-
100
-## 5.3 Listing file differences   
101
-Now we can look at what files have been **A**dded, **M**odified, **D**eleted due to the addition of those three packages and switching of the boot directories, by comparing the two commits.
102
-```
103
-root@photon-host-def [ ~ ]# ostree diff 2940 82bc
104
-M    /usr/etc/group-
105
-M    /usr/etc/gshadow
106
-M    /usr/etc/passwd-
107
-M    /usr/etc/shadow
108
-M    /usr/share/rpm/Basenames
109
-M    /usr/share/rpm/Conflictname
110
-M    /usr/share/rpm/Dirnames
111
-M    /usr/share/rpm/Group
112
-M    /usr/share/rpm/Installtid
113
-M    /usr/share/rpm/Name
114
-M    /usr/share/rpm/Obsoletename
115
-M    /usr/share/rpm/Packages
116
-M    /usr/share/rpm/Providename
117
-M    /usr/share/rpm/Requirename
118
-M    /usr/share/rpm/Sha1header
119
-M    /usr/share/rpm/Sigmd5
120
-M    /usr/share/rpm/Triggername
121
-M    /usr/share/rpm-ostree/treefile.json
122
-D    /boot/initramfs-4.0.9.img-49c11628bc4b702fcbf4a01abbb5249ddc845a81570a5616010f38b8967db197
123
-D    /boot/vmlinuz-4.0.9-49c11628bc4b702fcbf4a01abbb5249ddc845a81570a5616010f38b8967db197
124
-D    /usr/etc/gshadow-
125
-D    /usr/etc/shadow-
126
-D    /usr/lib/ostree-boot/initramfs-4.0.9.img-49c11628bc4b702fcbf4a01abbb5249ddc845a81570a5616010f38b8967db197
127
-D    /usr/lib/ostree-boot/vmlinuz-4.0.9-49c11628bc4b702fcbf4a01abbb5249ddc845a81570a5616010f38b8967db197
128
-A    /boot/initramfs-4.0.9.img-334842d15b642e70fac149bd5bbb7dd48965a3aca9da6a42d289a267a142f32f
129
-A    /boot/vmlinuz-4.0.9-334842d15b642e70fac149bd5bbb7dd48965a3aca9da6a42d289a267a142f32f
130
-A    /usr/bin/awk
131
-A    /usr/bin/gawk
132
-A    /usr/bin/gawk-4.1.0
133
-A    /usr/bin/igawk
134
-A    /usr/bin/sudo
135
-A    /usr/bin/sudoedit
136
-A    /usr/bin/sudoreplay
137
-A    /usr/bin/wget
138
-A    /usr/etc/pam.d/sudo
139
-A    /usr/etc/group.rpmnew
140
-A    /usr/etc/passwd.rpmnew
141
-A    /usr/etc/sudoers
142
-A    /usr/etc/wgetrc
143
-A    /usr/etc/sudoers.d
144
-A    /usr/include/gawkapi.h
145
-A    /usr/include/sudo_plugin.h
146
-A    /usr/lib/ostree-boot/initramfs-4.0.9.img-334842d15b642e70fac149bd5bbb7dd48965a3aca9da6a42d289a267a142f32f
147
-A    /usr/lib/ostree-boot/vmlinuz-4.0.9-334842d15b642e70fac149bd5bbb7dd48965a3aca9da6a42d289a267a142f32f
148
-A    /usr/lib/gawk
149
-A    /usr/lib/gawk/filefuncs.so
150
-A    /usr/lib/gawk/fnmatch.so
151
-A    /usr/lib/gawk/fork.so
152
-A    /usr/lib/gawk/inplace.so
153
-A    /usr/lib/gawk/ordchr.so
154
-A    /usr/lib/gawk/readdir.so
155
-A    /usr/lib/gawk/readfile.so
156
-A    /usr/lib/gawk/revoutput.so
157
-A    /usr/lib/gawk/revtwoway.so
158
-A    /usr/lib/gawk/rwarray.so
159
-A    /usr/lib/gawk/testext.so
160
-A    /usr/lib/gawk/time.so
161
-A    /usr/lib/sudo
162
-A    /usr/lib/sudo/group_file.so
163
-A    /usr/lib/sudo/libsudo_util.so
164
-A    /usr/lib/sudo/libsudo_util.so.0
165
-A    /usr/lib/sudo/libsudo_util.so.0.0.0
166
-A    /usr/lib/sudo/sudo_noexec.so
167
-A    /usr/lib/sudo/sudoers.so
168
-A    /usr/lib/sudo/system_group.so
169
-A    /usr/libexec/awk
170
-A    /usr/libexec/awk/grcat
171
-A    /usr/libexec/awk/pwcat
172
-A    /usr/sbin/visudo
173
-A    /usr/share/doc/gawk-4.1.0
174
-A    /usr/share/doc/gawk-4.1.0/api-figure1.eps
175
-A    /usr/share/doc/gawk-4.1.0/api-figure1.pdf
176
-A    /usr/share/doc/gawk-4.1.0/api-figure2.eps
177
-A    /usr/share/doc/gawk-4.1.0/api-figure2.pdf
178
-A    /usr/share/doc/gawk-4.1.0/api-figure3.eps
179
-A    /usr/share/doc/gawk-4.1.0/api-figure3.pdf
180
-A    /usr/share/doc/gawk-4.1.0/awkforai.txt
181
-A    /usr/share/doc/gawk-4.1.0/general-program.eps
182
-A    /usr/share/doc/gawk-4.1.0/general-program.pdf
183
-A    /usr/share/doc/gawk-4.1.0/lflashlight.eps
184
-A    /usr/share/doc/gawk-4.1.0/lflashlight.pdf
185
-A    /usr/share/doc/gawk-4.1.0/process-flow.eps
186
-A    /usr/share/doc/gawk-4.1.0/process-flow.pdf
187
-A    /usr/share/doc/gawk-4.1.0/rflashlight.eps
188
-A    /usr/share/doc/gawk-4.1.0/rflashlight.pdf
189
-A    /usr/share/doc/gawk-4.1.0/statist.eps
190
-A    /usr/share/doc/gawk-4.1.0/statist.jpg
191
-A    /usr/share/doc/gawk-4.1.0/statist.pdf
192
-A    /usr/share/doc/sudo-1.8.11p1
193
-A    /usr/share/doc/sudo-1.8.11p1/CONTRIBUTORS
194
-A    /usr/share/doc/sudo-1.8.11p1/ChangeLog
195
-A    /usr/share/doc/sudo-1.8.11p1/HISTORY
196
-A    /usr/share/doc/sudo-1.8.11p1/LICENSE
197
-A    /usr/share/doc/sudo-1.8.11p1/NEWS
198
-A    /usr/share/doc/sudo-1.8.11p1/README
199
-A    /usr/share/doc/sudo-1.8.11p1/TROUBLESHOOTING
200
-A    /usr/share/doc/sudo-1.8.11p1/UPGRADE
201
-A    /usr/share/doc/sudo-1.8.11p1/sample.pam
202
-A    /usr/share/doc/sudo-1.8.11p1/sample.sudo.conf
203
-A    /usr/share/doc/sudo-1.8.11p1/sample.sudoers
204
-A    /usr/share/doc/sudo-1.8.11p1/sample.syslog.conf
205
-A    /usr/share/locale/be/LC_MESSAGES/wget.mo
206
-A    /usr/share/locale/bg/LC_MESSAGES/wget.mo
207
-A    /usr/share/locale/ca/LC_MESSAGES/sudo.mo
208
-A    /usr/share/locale/ca/LC_MESSAGES/sudoers.mo
209
-A    /usr/share/locale/ca/LC_MESSAGES/wget.mo
210
-A    /usr/share/locale/cs/LC_MESSAGES/sudo.mo
211
-A    /usr/share/locale/cs/LC_MESSAGES/sudoers.mo
212
-A    /usr/share/locale/cs/LC_MESSAGES/wget.mo
213
-A    /usr/share/locale/da/LC_MESSAGES/gawk.mo
214
-A    /usr/share/locale/da/LC_MESSAGES/sudo.mo
215
-A    /usr/share/locale/da/LC_MESSAGES/sudoers.mo
216
-A    /usr/share/locale/da/LC_MESSAGES/wget.mo
217
-A    /usr/share/locale/de/LC_MESSAGES/gawk.mo
218
-A    /usr/share/locale/de/LC_MESSAGES/sudo.mo
219
-A    /usr/share/locale/de/LC_MESSAGES/sudoers.mo
220
-A    /usr/share/locale/de/LC_MESSAGES/wget.mo
221
-A    /usr/share/locale/el/LC_MESSAGES/sudoers.mo
222
-A    /usr/share/locale/el/LC_MESSAGES/wget.mo
223
-A    /usr/share/locale/en_GB/LC_MESSAGES/wget.mo
224
-A    /usr/share/locale/eo/LC_MESSAGES/sudo.mo
225
-A    /usr/share/locale/eo/LC_MESSAGES/sudoers.mo
226
-A    /usr/share/locale/eo/LC_MESSAGES/wget.mo
227
-A    /usr/share/locale/es/LC_MESSAGES/gawk.mo
228
-A    /usr/share/locale/es/LC_MESSAGES/sudo.mo
229
-A    /usr/share/locale/es/LC_MESSAGES/wget.mo
230
-A    /usr/share/locale/et/LC_MESSAGES/wget.mo
231
-A    /usr/share/locale/eu/LC_MESSAGES/sudo.mo
232
-A    /usr/share/locale/eu/LC_MESSAGES/sudoers.mo
233
-A    /usr/share/locale/eu/LC_MESSAGES/wget.mo
234
-A    /usr/share/locale/fi/LC_MESSAGES/gawk.mo
235
-A    /usr/share/locale/fi/LC_MESSAGES/sudo.mo
236
-A    /usr/share/locale/fi/LC_MESSAGES/sudoers.mo
237
-A    /usr/share/locale/fi/LC_MESSAGES/wget.mo
238
-A    /usr/share/locale/fr/LC_MESSAGES/gawk.mo
239
-A    /usr/share/locale/fr/LC_MESSAGES/sudo.mo
240
-A    /usr/share/locale/fr/LC_MESSAGES/wget.mo
241
-A    /usr/share/locale/ga/LC_MESSAGES/wget.mo
242
-A    /usr/share/locale/gl/LC_MESSAGES/sudo.mo
243
-A    /usr/share/locale/gl/LC_MESSAGES/wget.mo
244
-A    /usr/share/locale/he/LC_MESSAGES/wget.mo
245
-A    /usr/share/locale/hr/LC_MESSAGES/sudo.mo
246
-A    /usr/share/locale/hr/LC_MESSAGES/sudoers.mo
247
-A    /usr/share/locale/hr/LC_MESSAGES/wget.mo
248
-A    /usr/share/locale/hu/LC_MESSAGES/wget.mo
249
-A    /usr/share/locale/id/LC_MESSAGES/wget.mo
250
-A    /usr/share/locale/it/LC_MESSAGES/gawk.mo
251
-A    /usr/share/locale/it/LC_MESSAGES/sudo.mo
252
-A    /usr/share/locale/it/LC_MESSAGES/sudoers.mo
253
-A    /usr/share/locale/it/LC_MESSAGES/wget.mo
254
-A    /usr/share/locale/ja/LC_MESSAGES/gawk.mo
255
-A    /usr/share/locale/ja/LC_MESSAGES/sudo.mo
256
-A    /usr/share/locale/ja/LC_MESSAGES/sudoers.mo
257
-A    /usr/share/locale/ja/LC_MESSAGES/wget.mo
258
-A    /usr/share/locale/lt/LC_MESSAGES/sudoers.mo
259
-A    /usr/share/locale/lt/LC_MESSAGES/wget.mo
260
-A    /usr/share/locale/ms/LC_MESSAGES/gawk.mo
261
-A    /usr/share/locale/nb/LC_MESSAGES/sudo.mo
262
-A    /usr/share/locale/nb/LC_MESSAGES/sudoers.mo
263
-A    /usr/share/locale/nb/LC_MESSAGES/wget.mo
264
-A    /usr/share/locale/nl/LC_MESSAGES/gawk.mo
265
-A    /usr/share/locale/nl/LC_MESSAGES/sudo.mo
266
-A    /usr/share/locale/nl/LC_MESSAGES/sudoers.mo
267
-A    /usr/share/locale/nl/LC_MESSAGES/wget.mo
268
-A    /usr/share/locale/pl/LC_MESSAGES/gawk.mo
269
-A    /usr/share/locale/pl/LC_MESSAGES/sudo.mo
270
-A    /usr/share/locale/pl/LC_MESSAGES/sudoers.mo
271
-A    /usr/share/locale/pl/LC_MESSAGES/wget.mo
272
-A    /usr/share/locale/pt/LC_MESSAGES/wget.mo
273
-A    /usr/share/locale/pt_BR/LC_MESSAGES/sudo.mo
274
-A    /usr/share/locale/pt_BR/LC_MESSAGES/sudoers.mo
275
-A    /usr/share/locale/pt_BR/LC_MESSAGES/wget.mo
276
-A    /usr/share/locale/ro/LC_MESSAGES/wget.mo
277
-A    /usr/share/locale/ru/LC_MESSAGES/sudo.mo
278
-A    /usr/share/locale/ru/LC_MESSAGES/wget.mo
279
-A    /usr/share/locale/sk/LC_MESSAGES/wget.mo
280
-A    /usr/share/locale/sl/LC_MESSAGES/sudo.mo
281
-A    /usr/share/locale/sl/LC_MESSAGES/sudoers.mo
282
-A    /usr/share/locale/sl/LC_MESSAGES/wget.mo
283
-A    /usr/share/locale/sr/LC_MESSAGES/sudo.mo
284
-A    /usr/share/locale/sr/LC_MESSAGES/sudoers.mo
285
-A    /usr/share/locale/sr/LC_MESSAGES/wget.mo
286
-A    /usr/share/locale/sv/LC_MESSAGES/gawk.mo
287
-A    /usr/share/locale/sv/LC_MESSAGES/sudo.mo
288
-A    /usr/share/locale/sv/LC_MESSAGES/sudoers.mo
289
-A    /usr/share/locale/sv/LC_MESSAGES/wget.mo
290
-A    /usr/share/locale/tr/LC_MESSAGES/sudo.mo
291
-A    /usr/share/locale/tr/LC_MESSAGES/sudoers.mo
292
-A    /usr/share/locale/tr/LC_MESSAGES/wget.mo
293
-A    /usr/share/locale/uk/LC_MESSAGES/sudo.mo
294
-A    /usr/share/locale/uk/LC_MESSAGES/sudoers.mo
295
-A    /usr/share/locale/uk/LC_MESSAGES/wget.mo
296
-A    /usr/share/locale/vi/LC_MESSAGES/gawk.mo
297
-A    /usr/share/locale/vi/LC_MESSAGES/sudo.mo
298
-A    /usr/share/locale/vi/LC_MESSAGES/sudoers.mo
299
-A    /usr/share/locale/vi/LC_MESSAGES/wget.mo
300
-A    /usr/share/locale/zh_CN/LC_MESSAGES/sudo.mo
301
-A    /usr/share/locale/zh_CN/LC_MESSAGES/sudoers.mo
302
-A    /usr/share/locale/zh_CN/LC_MESSAGES/wget.mo
303
-A    /usr/share/locale/zh_TW/LC_MESSAGES/wget.mo
304
-A    /usr/share/man/man1/gawk.1.gz
305
-A    /usr/share/man/man1/igawk.1.gz
306
-A    /usr/share/man/man1/wget.1.gz
307
-A    /usr/share/man/man3/filefuncs.3am.gz
308
-A    /usr/share/man/man3/fnmatch.3am.gz
309
-A    /usr/share/man/man3/fork.3am.gz
310
-A    /usr/share/man/man3/ordchr.3am.gz
311
-A    /usr/share/man/man3/readdir.3am.gz
312
-A    /usr/share/man/man3/readfile.3am.gz
313
-A    /usr/share/man/man3/revoutput.3am.gz
314
-A    /usr/share/man/man3/revtwoway.3am.gz
315
-A    /usr/share/man/man3/rwarray.3am.gz
316
-A    /usr/share/man/man3/time.3am.gz
317
-A    /usr/share/man/man5/sudo.conf.5.gz
318
-A    /usr/share/man/man5/sudoers.5.gz
319
-A    /usr/share/man/man8/sudo.8.gz
320
-A    /usr/share/man/man8/sudo_plugin.8.gz
321
-A    /usr/share/man/man8/sudoedit.8.gz
322
-A    /usr/share/man/man8/sudoreplay.8.gz
323
-A    /usr/share/man/man8/visudo.8.gz
324
-A    /usr/share/awk
325
-A    /usr/share/awk/assert.awk
326
-A    /usr/share/awk/bits2str.awk
327
-A    /usr/share/awk/cliff_rand.awk
328
-A    /usr/share/awk/ctime.awk
329
-A    /usr/share/awk/ftrans.awk
330
-A    /usr/share/awk/getopt.awk
331
-A    /usr/share/awk/gettime.awk
332
-A    /usr/share/awk/group.awk
333
-A    /usr/share/awk/inplace.awk
334
-A    /usr/share/awk/join.awk
335
-A    /usr/share/awk/libintl.awk
336
-A    /usr/share/awk/noassign.awk
337
-A    /usr/share/awk/ord.awk
338
-A    /usr/share/awk/passwd.awk
339
-A    /usr/share/awk/quicksort.awk
340
-A    /usr/share/awk/readable.awk
341
-A    /usr/share/awk/rewind.awk
342
-A    /usr/share/awk/round.awk
343
-A    /usr/share/awk/strtonum.awk
344
-A    /usr/share/awk/walkarray.awk
345
-A    /usr/share/awk/zerofile.awk
346
-```
347
- 
348
-## 5.4 Listing package differences
349
-We can also look at package differences, as you expect, using the right tool for the job.
350
-```
351
-root@photon-host-def [ ~ ]# rpm-ostree db diff 2940 82bc    
352
-ostree diff commit old: 2940 (2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8)
353
-ostree diff commit new: 82bc (82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817)
354
-Added:
355
- gawk-4.1.0-2.ph1.x86_64
356
- sudo-1.8.11p1-4.ph1.x86_64
357
- wget-1.15-1.ph1.x86_64
358
-```
359
-
360
-## 5.5 Rollback
361
-If we want to go back to the previous image, we can rollback. The order of the images will be changed, so the old filetree will become the default bootable image. If -r option is passed, the rollback will continue with a reboot.
362
-```
363
-root@photon-host-def [ ~ ]# rpm-ostree rollback
364
-Moving '2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0' to be first deployment
365
-Transaction complete; bootconfig swap: yes deployment count change: 0
366
-Removed:
367
-  gawk-4.1.0-2.ph1.x86_64
368
-  sudo-1.8.11p1-4.ph1.x86_64
369
-  wget-1.15-1.ph1.x86_64
370
-Successfully reset deployment order; run "systemctl reboot" to start a reboot
371
-```
372
-In fact, we can repeat the rollback operation as many times as we want before reboot. On each execution, it's going to change the order. It will not delete any image.  
373
-However, an upgrade will keep the current default image and will eliminate the other image, whichever that is. So if Photon installation rolled back to an older build, an upgrade will keep that, eliminate the newer version and will replace it with an even newer version at the next upgrade.  
374
-
375
-![grub-boot-0-1](https://cloud.githubusercontent.com/assets/13158414/9673725/3d33162a-525c-11e5-8292-5b79c48e0c6b.png)  
376
-The boot order moved back to original:
377
-```
378
-root@photon-host-def [ ~ ]# rpm-ostree status
379
-  TIMESTAMP (UTC)       VERSION             ID           OSNAME   REFSPEC                              
380
-* 2015-08-20 22:27:43   1.0_minimal     2940e10c4d   photon   photon:photon/1.0/x86_64/minimal     
381
-  2015-09-03 00:34:41   1.0_minimal.1   82bca728ea   photon   photon:photon/1.0/x86_64/minimal   
382
-```
383
-The current bootable image path moved also back to the original value:
384
-```
385
-root@photon-host-def [ ~ ]# ostree admin config-diff --print-current-dir
386
-/ostree/deploy/photon/deploy/2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0 
387
-```
388
-
389
-## 5.6 Deleting a deployed filetree
390
-It is possible to delete a deployed tree. You won't need to do that normally, as upgrading to a new image will delete the old one, but if for some reason deploying failed (loss of power, networking issues), you'll want to delete the partially deployed image.  
391
-The only supported index is 1. (If multiple bootable images will be supported in the future, a larger than one, zero-based index of the image to delete will be supported).  
392
-You cannot delete the default bootable filetree, so passing 0 will result in an error.  
393
-```
394
-root@photon-host-def [ ~ ]# ostree admin undeploy -v 1
395
-OT: Using bootloader: OstreeBootloaderGrub2
396
-Transaction complete; bootconfig swap: yes deployment count change: -1
397
-Deleted deployment 82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817.0
398
-
399
-root@photon-host-cus1 [ ~ ]# ostree admin undeploy -v 0
400
-error: Cannot undeploy currently booted deployment 0
401
-```
402
-Now, we can see that the newer image is gone, the deployment directory for commit 82bc has been removed.  
403
-```
404
-root@photon-host-def [ ~ ]# rpm-ostree status
405
-  TIMESTAMP (UTC)        VERSION        ID            OSNAME    REFSPEC                              
406
-* 2015-08-20 22:27:43    1.0_minimal    2940e10c4d    photon    photon:photon/1.0/x86_64/minimal 
407
-root@photon-host-cus1 [ ~ ]# ls /ostree/deploy/photon/deploy/                                        
408
-2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0
409
-2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0.origin   
410
-```
411
-However the commit is still there in the OSTree repo.
412
-```
413
-root@photon-host-def [ ~ ]# ostree log 82bc                 
414
-commit 82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817
415
-Date:  2015-09-03 00:34:41 +0000
416
-Version: 1.0_minimal.1
417
-
418
-
419
-commit 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
420
-Date:  2015-08-20 22:27:43 +0000
421
-Version: 1.0_minimal
422
-```
423
-But there is nothing to rollback to.
424
-```
425
-root@photon-host-def [ ~ ]# rpm-ostree rollback
426
-error: Found 1 deployments, at least 2 required for rollback
427
-```
428
-If we were to upgrade again, it would bring these packages back, but let's just check the differeneces.
429
-```
430
-root@photon-host-def [ ~ ]# rpm-ostree upgrade --check-diff
431
-Updating from: photon:photon/1.0/x86_64/minimal
432
-
433
-
434
-+gawk-4.1.0-2.ph1.x86_64
435
-+sudo-1.8.11p1-4.ph1.x86_64
436
-+wget-1.15-1.ph1.x86_64
437
-```
438
-
439
-## 5.7 Version skipping upgrade
440
-
441
-Let's assume that after a while, VMware releases version 2 that removes **sudo** and adds **bison** and **tar**. Now, an upgrade will skip version 1 and go directly to 2. Let's first look at what packages are pulled (notice sudo missing, as expected), then upgrade with reboot option.
442
-```
443
-root@photon-host-def [ ~ ]# rpm-ostree upgrade --check-diff
444
-Updating from: photon:photon/1.0/x86_64/minimal
445
-
446
-7 metadata, 13 content objects fetched; 1287 KiB transferred in 0 seconds
447
-+bison-3.0.2-2.ph1.x86_64
448
-+gawk-4.1.0-2.ph1.x86_64
449
-+tar-1.27.1-1.ph1.x86_64
450
-+wget-1.15-1.ph1.x86_64
451
-
452
-root@photon-host-def [ ~ ]# rpm-ostree upgrade -r          
453
-Updating from: photon:photon/1.0/x86_64/minimal
454
-
455
-107 metadata, 512 content objects fetched; 13064 KiB transferred in 1 seconds
456
-Copying /etc changes: 5 modified, 0 removed, 16 added
457
-Transaction complete; bootconfig swap: yes deployment count change: 1
458
-Freed objects: 19.3 MB
459
-```
460
-After reboot, let's check the booting filetrees, the current dir for the current filetree and look at commit differences:
461
-```
462
-root@photon-host-def [ ~ ]# rpm-ostree status 
463
-  TIMESTAMP (UTC)        VERSION          ID            OSNAME    REFSPEC                              
464
-* 2015-09-04 00:36:37    1.0_minimal.2    092e21d292    photon    photon:photon/1.0/x86_64/minimal
465
-  2015-08-20 22:27:43    1.0_minimal      2940e10c4d    photon    photon:photon/1.0/x86_64/minimal
466
-
467
-root@photon-host-cus1 [ ~ ]# ostree admin config-diff --print-current-dir
468
-/ostree/deploy/photon/deploy/092e21d2928090d507ce711d482e4402e310b5a7f46532c5e24e0789590d0373.0
469
-
470
-root@photon-host-cus1 [ ~ ]# rpm-ostree db diff  2940 092e
471
-ostree diff commit old: 2940 (2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8)
472
-ostree diff commit new: 092e (092e21d2928090d507ce711d482e4402e310b5a7f46532c5e24e0789590d0373)
473
-Added:
474
- bison-3.0.2-2.ph1.x86_64
475
- gawk-4.1.0-2.ph1.x86_64
476
- tar-1.27.1-1.ph1.x86_64
477
- wget-1.15-1.ph1.x86_64
478
-
479
-root@photon-host-cus1 [ ~ ]# rpm-ostree db diff  82bc 092e
480
-error: Refspec '82bc' not found
481
-```
482
-Interesting fact: The metadata for commit 82bc has been removed from the local repo!  
483
-
484
-## 5.8 Tracking parent commits
485
-OSTree will display limited commit history - maximum 2 levels, so if you want to traverse the history even though it may not find a commitment by its ID, you can refer to its parent using '^' suffix, grandfather via '^^' and so on. We know that 82bc is the parent of 092e:
486
-```
487
-root@photon-host-def [ ~ ]# rpm-ostree db diff  092e^ 092e
488
-error: No such metadata object 82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817.commit
489
-error: Refspec '82cb' not found
490
-root@photon-host-def [ ~ ]# rpm-ostree db diff  092e^^ 092e
491
-error: No such metadata object 82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817.commit
492
-````
493
-So commit 092e knows who its parent is, but its metadata is no longer in the local repo, so it cannot traverse further to its parent to find an existing grandfather.
494
-
495
-## 5.9 Resetting a branch to a previous commit
496
-We can reset the head of a branch in a local repo to a previous commit, for example corresponding to version 0 (1.0_minimal).
497
-```
498
-root@photon-host-def [ ~ ]# ostree reset photon:photon/1.0/x86_64/minimal 2940
499
-```
500
-Now if wee look again at the branch commit history, the head is at version 0.  
501
-```
502
-root@photon-host-def [ ~ ]# ostree log photon/1.0/x86_64/minimal
503
-commit 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
504
-Date:  2015-08-20 22:27:43 +0000
505
-Version: 1.0_minimal
506
-```
507 1
deleted file mode 100644
... ...
@@ -1,49 +0,0 @@
1
-# Installing a server
2
-
3
-This is the server that is going to be used by a system administrator or a package installer developer to compose filesystem trees and make them available to hosts (or clients) to pull (download) and deploy.  
4
-
5
-The first step is to download the ISO for the desired release, if you have not done that already:  
6
-[Photon 1.0 GA ISO file](https://bintray.com/artifact/download/vmware/photon/photon-1.0-13c08b6.iso)  
7
-[Photon 1.0 Rev2 ISO file](https://bintray.com/artifact/download/vmware/photon/photon-1.0-62c543d.iso)  
8
-[Photon OS 2.0 Beta ISO file](https://bintray.com/vmware/photon/download_file?file_path=2.0%2FBeta%2Fiso%2Fphoton-2.0-8553d58.iso)  
9
-
10
-Installation steps are the same to all Photon OS versions, except that under the hood:
11
-* Photon 1.0 sets up a 'minimal' sample file tree, so it's ready to accept host pull/install requests right away.
12
-* Photon 2.0 does not set up a file tree, so there are several steps needed post-install to have a completely functional server that host can deploy from; they will be explained in detail in Chapter 8 and 9, but a quick setup is provided for you later in this chapter.  
13
-
14
-## 6.1 Manual install of a server
15
-First, create a new VM in Fusion, Workstation or ESXi box, and go through the [steps common to all installation profiles](Running-Project-Photon-on-Fusion.md), then select the "Photon OSTree Server" option.
16
-
17
-![PhotonChooseServer](https://cloud.githubusercontent.com/assets/13158414/14802949/1c5f92b8-0b0a-11e6-8d69-96e62218dfcb.png)
18
-
19
-Continue with setting up a host name (like photon-srv) and a root password and that's all you need. Installation took about 40 seconds for Fusion running on my Mac with SSD, but it should take longer time for spin hard drives.  
20
-
21
-For Photon 1.0, once the server boots, the RPM-OSTree repository is ready to accept pull request from hosts, because setting up a 'minimal' tree is part of installation. This ostree 'minimal' configuration is almost identical, as far as packages list, to the 'Photon Minimal' installation profile from 'Select Installation' menu. 
22
-
23
-![PhotonServerLogin](https://cloud.githubusercontent.com/assets/13158414/14802957/2f5ed7e8-0b0a-11e6-960d-04c6202b0c4e.png)
24
-
25
-
26
-In order for hosts to access server's OSTree repo via http, an Apache web server is configured as part of installation. If you want to also serve https, you need to take additional steps - configure the web server, open port 443 via iptables and install certificates specific to your organization, that I won't cover here.  
27
-
28
-The server's IP address will be passed to the Photon RPM-OSTree hosts that want to connect to this server.  
29
-You may ask your network administrator for a static IP, registered to your company's DNS, so your users who install Photon RPM-OSTree hosts will enter a pretty name like http://photon-srv.yourcompany.com, rather than remember a numeric IP address.
30
-
31
-Having the server configured, you may advance to next chapter to [install your own host from this server's repository](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md). That's a way to verify right away that all components (server, network) are running correctly and test the 'minimal' server filetree image by downloading and installing it at the host.
32
-
33
-## 6.2 Composing your first OSTree repo
34
-If you've installed Photon 2.0 OSTree server, the server did not setup a tree as part of an installation, but configuration files for starter 'base', 'minimal' and 'full' tree are there for you. To create a 'minimal' tree, you only need two commands - one to initialize a new repo, the other one to compose it.
35
-```
36
-root [ ~ ]# cd /srv/rpm-ostree
37
-root [ /srv/rpm-ostree ]# ostree --repo=repo init --mode=archive-z2
38
-root [ /srv/rpm-ostree ]# rpm-ostree compose tree --repo=repo photon-base.json
39
-```
40
-You are now ready to deploy a host, explained in next chapter. Skip to [Chapter 8: File oriented server operations](Photon-RPM-OStree-8-File-oriented-server-operations.md) and [Chapter 9: Package oriented server operations](Photon-RPM-OSTree-9-Package-oriented-server-operations.md) to learn create your own customized file tree.   
41
-
42
-## 6.3 Automated install of a server via kickstart
43
-All Photon OS versions support unattended install, in other words installer will display its progress, but will not prompt for any keys to be clicked, and will boot at the end of installation. This will create an identical server as installing via UI.
44
-
45
-If not familiar with the way kickstart works, visit [Kickstart Support in Photon OS](kickstart.md). The kickstart json config for OSTree is similar to minimal or full, except for this setting:  
46
-```
47
-"type": "ostree_server"
48
-```
49
-
50 1
deleted file mode 100644
... ...
@@ -1,39 +0,0 @@
1
-# Installing a Photon RPM-OStree host against a custom server repository
2
-
3
-Organizations that maintain their own OSTree servers create custom image trees suited to their needs from which hosts can be deployed and upgraded. One single server may make available several branches to install, for example "base", "minimal" and "full". Or, if you think in terms of Windows OS SKUs - "Home", "Professional" or "Enterprise" edition.
4
-
5
-So in fact there are two pieces of information the OSTree host installer needs - the server URL and the branch ref. Also, there are two ways to pass this info - manually via keyboard, when prompted and automated, by reading from a config file.
6
-
7
-## 7.1 Manual install of a custom host
8
-For Photon 1.0 or 1.0 Revision 2, installing a Photon RPM-OSTree host that will pull from a server repository of your choice is very similar to the way we installed the host against the default server repo in [Chapter 2](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md).  
9
-We will follow the same steps, selecting "Photon OSTree Host", and after assigning a host name like **photon-host** and a root password, this time we will click on "Custom RPM-OSTree Server".  
10
-
11
-![PhotonHostCustom](https://cloud.githubusercontent.com/assets/13158414/14804629/fe17c7d4-0b19-11e6-9cc6-7e79f768b7b1.png)
12
-
13
-An additional screen will ask for the URL of server repo - just enter the IP address or fully qualified domain name of the [server installed in the previous step](Photon-RPM-OSTree-6-Installing-a-server.md).  
14
-
15
-![PhotonHostCustomURL](https://cloud.githubusercontent.com/assets/13158414/14804647/185f1aa2-0b1a-11e6-9e44-e2f54592da35.png)
16
-
17
-You will then be asked to enter a Refspec. Leave the default 'photon/1.0/x86_64/minimal' value, unless you've created a new branch at the server (we will see later how to do that).  
18
-
19
-![PhotonHostCustomRefspec](https://cloud.githubusercontent.com/assets/13158414/14804653/1f0d31cc-0b1a-11e6-8f56-e8cac1f72852.png)
20
-
21
-Once this is done and the installation finished, reboot and you are ready to use it.  
22
-You may verify - just like in [Chapter 3.1](Photon-RPM-OStree-3-Concepts-in-action#31-querying-the-deployed-filetrees.md) - that you can get an rpm-ostree status. The value for the CommitID should be identical to the [host that installed from default repo](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md), if the [server](Photon-RPM-OSTree-6-Installing-a-server.md) has been installed fresh, from the same ISO.  
23
-
24
-Photon 2.0 does not provide the UI option to install an RPM-OSTree host, but supports automated, UI-less install, that we'll explore next.
25
-
26
-## 7.2 Automated install of a custom host via kickstart
27
-Photon 1.0, 1.0 Revision 2 and Photon OS 2.0 support automated install that will not interact with the user, in other words installer will display its progress, but will not prompt for any keys to be clicked, and will boot at the end of installation.  
28
-
29
-If not familiar with the way kickstart works, visit [Kickstart Support in Photon OS](kickstart.md). The kickstart json config for OSTree is similar to minimal or full, except for these settings that should sound familiar: 
30
-```
31
-    ...
32
-    "type": "ostree_host",
33
-    "ostree_repo_url": "http://192.168.218.249",
34
-    "ostree_repo_ref": "photon/1.0/x86_64/minimal",
35
-    ...
36
-```
37
-If the server is Photon OS 2.0, and the administrator composed trees for the included json files, the ostree_repo_ref will take either value: **photon/2.0/x86_64/base**, **photon/2.0/x86_64/minimal**, or **photon/2.0/x86_64/full**.
38
-
39
-In most situations, kickstart file is accessed via http from PXE boot. That enables booting from network and end to end install of hosts from pre-defined server URL and branch without assistance from user. 
40 1
deleted file mode 100644
... ...
@@ -1,321 +0,0 @@
1
-# Package Oriented Server Operations
2
-
3
-Now that we have a Photon RPM-OSTree server up and running (if not, see how to [install](Photon-RPM-OSTree-6-Installing-a-server.md)), we will learn how to provide the desired set of packages as input and instruct rpm-ostree to compose a filetree, that will result in creation (or update) of an OSTree repo.   
4
-The simplest way to explain is to take a look at the files installed by the Photon RPM-OSTree server during setup.  
5
-```  
6
-root [ ~ ]# cd /srv/rpm-ostree/
7
-root [ /srv/rpm-ostree ]# ls -l
8
-total 16
9
-lrwxrwxrwx 1 root root   31 Aug 28 19:06 lightwave-ostree.repo -> /etc/yum.repos.d/lightwave.repo
10
--rw-r--r-- 1 root root 7356 Aug 28 19:06 ostree-httpd.conf
11
--rw-r--r-- 1 root root 1085 Aug 28 19:06 photon-base.json
12
-lrwxrwxrwx 1 root root   35 Aug 28 19:06 photon-extras-ostree.repo -> /etc/yum.repos.d/photon-extras.repo
13
-lrwxrwxrwx 1 root root   32 Aug 28 19:06 photon-iso-ostree.repo -> /etc/yum.repos.d/photon-iso.repo
14
-lrwxrwxrwx 1 root root   28 Aug 28 19:06 photon-ostree.repo -> /etc/yum.repos.d/photon.repo
15
-lrwxrwxrwx 1 root root   36 Aug 28 19:06 photon-updates-ostree.repo -> /etc/yum.repos.d/photon-updates.repo
16
-drwxr-xr-x 7 root root 4096 Aug 20 22:27 repo
17
-```
18
-## 9.1 JSON configuration file
19
-How can we tell rpm-ostree what packages we want to include, where to get them from and how to compose the filetree? There is JSON file for that. Let's take a look at photon-base.json used by the Photon OS team.  
20
-```
21
-root [ /srv/rpm-ostree ]# cat photon-base.json 
22
-{
23
-    "comment": "Photon Minimal OSTree",
24
-
25
-    "osname": "photon",
26
-
27
-    "ref": "photon/1.0/x86_64/minimal",
28
-
29
-    "automatic_version_prefix": "1.0_minimal",
30
-
31
-    "repos": ["photon"],
32
-
33
-    "selinux": false,
34
-
35
-    "initramfs-args": ["--no-hostonly"],
36
-
37
-    "bootstrap_packages": ["filesystem"],
38
-
39
-    "packages": ["glibc", "zlib", "binutils", "gmp", "mpfr", "libgcc", "libstdc++","libgomp",
40
-                "pkg-config", "ncurses", "bash", "bzip2", "cracklib", "cracklib-dicts", "shadow",
41
-                "procps-ng", "iana-etc", "readline", "coreutils", "bc", "libtool", "inetutils",
42
-                "findutils", "xz", "grub2", "iproute2", "util-linux", "linux",
43
-                "attr", "libcap", "kmod", "expat", "dbus", "file",
44
-                "sed", "grep", "cpio", "gzip",
45
-                "openssl", "ca-certificates", "curl",
46
-                "systemd",
47
-                "openssh", "iptables",
48
-                "photon-release",
49
-                "vim", "tdnf",
50
-                "docker","bridge-utils",
51
-                "dracut", "dracut-tools", "rpm-ostree", "nss-altfiles", "which"]
52
-}
53
-``` 
54
-There are some mandatory settings, some optional. I'm only going to explain the most important ones for our use case.  
55
-**osname** and **ref** should be familiar, they have been explained in previous sections [OSname](Photon-RPM-OStree-3-Concepts-in-action.md#34-osname) and [Refspec](Photon-RPM-OStree-3-Concepts-in-action.md#35-refspec). Basicaly, we are asking `rpm-ostree` to compose a tree for photon OS and photon/1.0/x86_64/minimal branch.
56
-
57
-## 9.2 Package addition, removal, upgrade 
58
-**packages** is the list of packages that are to be added, in this case, in the "minimal" installation profile, on top of the packages already included by default. This is not quite the identical set of RPMS you get when you select the minimal profile in the ISO installer, but it's pretty close and that's why it's been named the same. 
59
-Let's add to the list three new packages: gawk, sudo and wget using `vim photon-base.json`
60
-
61
-**!!!Warning: do not remove any packages from the default list, even an "innocent" one, as it may bring the system to an unstable condition.  During my testing, I've removed "which"; it turns out it was used to figure out the grub booting roots: on reboot, the system was left hanging at grub prompt.**
62
-
63
-## 9.3 RPMS repository
64
-But where are these packages located? RPM-OStree uses the same standard RPMS repositories, that yum installs from.
65
-``` 
66
-root [ /srv/rpm-ostree ]# ls /etc/yum.repos.d/
67
-lightwave.repo  photon-iso.repo  photon-updates.repo  photon.repo
68
-```
69
-Going back to our JSON file, **repos** is a multi-value setting that tells RPM-OSTree in what RPMS repositories to look for packages. In this case, it looks in the current directory for a "photon" repo configuration file, that is a .repo file starting with a [photon] section. There is such a file: **photon-ostree.repo**, that is in fact a link to **photon.repo** in /etc/yum.repos.d directory.
70
-``` 
71
-root [ /srv/rpm-ostree ]# cat /etc/yum.repos.d/photon.repo 
72
-[photon]
73
-name=VMware Photon Linux 1.0(x86_64)
74
-baseurl=https://dl.bintray.com/vmware/photon_release_1.0_x86_64
75
-gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
76
-gpgcheck=1
77
-enabled=1
78
-skip_if_unavailable=True
79
-```
80
-In this case, `rpm-ostree` is instructed to download its packages in RPM format from the bintray URL, that is the location of an online RPMS repo maintained by the WMware Photon OS team. To make sure those packages are genuine, signed by VMware, the signature is checked against the official VMware public key.
81
-
82
-So what's in an RPMS repository? If we point the browser to https://dl.bintray.com/vmware/photon_release_1.0_x86_64, we can see there are three top directories:
83
-* noarch - where all packages that don't depend on the architecture reside. Those may contain scripts, platform neutral source files, configuration.
84
-* x86_64 - platform dependent packages for Intel 32 and 64 bits CPUs.
85
-* repodata - internal repo management data, like a catalog of all packages, and for every package its name, id, version, architecture and full path file/directory list. There is also a compressed XML file containing the history of changelogs extracted from github, as packages in RPM format were built by Photon OS team members from sources.
86
-
87
-Fortunately, in order to compose a tree, you don't need to download the packages from the online repository (which is time consuming - in the order of minutes), unless there are some new ones or updated versions of them, added by the Photon team after shipping 1.0 version or the 1.0 Refresh. A copy of the starter RPMS repository (as of 1.0 shipping date) has been included on the CD-ROM and you can access it.
88
-```
89
-root [ /srv/rpm-ostree ]# mount /dev/cdrom
90
-root [ /srv/rpm-ostree ]# ls /mnt/cdrom/RPMS
91
-noarch  repodata  x86_64
92
-```
93
-All you have to do now is to replace the `"repos": ["photon"]` entry by `"repos": ["photon-iso"]`, which will point to the RPMS repo on CD-ROM, rather than the online repo. This way, composing saves time, bandwidth and reduces to zero the risk of failure because of a networking issue. 
94
-
95
-_**Note**_: Check from time to time if the [known issue](Photon-RPM-OSTree-Appendix-A:-Known-issues.md#error-composing-when-photon-iso-repo-is-selected) has been fixed.
96
-```
97
-root [ /srv/rpm-ostree ]# cat /etc/yum.repos.d/photon-iso.repo 
98
-[photon-iso]
99
-name=VMWare Photon Linux 1.0(x86_64)
100
-baseurl=file:///mnt/cdrom/RPMS
101
-gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
102
-gpgcheck=1
103
-enabled=0
104
-skip_if_unavailable=True
105
-```
106
-
107
-There are already in current directory links created to all repositories in /etc/yum.repos.d, so they are found when tree compose command is invoked. You may add any other repo to the list and include packages found in that repo to be part of the image. 
108
-
109
-
110
-## 9.4 Composing a tree
111
-After so much preparation, it's time to execute a tree compose. We've only added 3 new packages and changed the RPMS repo source. Assuming you've already edited the JSON file, let's do it.
112
-```
113
-root [ /srv/rpm-ostree ]# rpm-ostree compose tree --repo=repo photon-base.json
114
-Previous commit: 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
115
-
116
-Downloading metadata [=========================================================================] 100%
117
-
118
-Transaction: 117 packages
119
-  Linux-PAM-1.1.8-2.ph1.x86_64
120
-  attr-2.4.47-1.ph1.x86_64
121
-  ...
122
-  gawk-4.1.0-2.ph1.x86_64
123
-  ...
124
-  sudo-1.8.11p1-4.ph1.x86_64
125
-  ...
126
-  wget-1.15-1.ph1.x86_64
127
-  which-2.20-1.ph1.x86_64
128
-  xz-5.0.5-2.ph1.x86_64
129
-  zlib-1.2.8-2.ph1.x86_64
130
-Installing packages [==========================================================================] 100%
131
-Writing '/var/tmp/rpm-ostree.TVO089/rootfs.tmp/usr/share/rpm-ostree/treefile.json'
132
-Preparing kernel
133
-Creating empty machine-id
134
-Executing: /usr/bin/dracut -v --tmpdir=/tmp -f /var/tmp/initramfs.img 4.0.9 --no-hostonly
135
-...
136
-*** Including module: bash ***
137
-*** Including module: kernel-modules ***
138
-*** Including module: resume ***
139
-*** Including module: rootfs-block ***
140
-*** Including module: terminfo ***
141
-*** Including module: udev-rules ***
142
-Skipping udev rule: 91-permissions.rules
143
-Skipping udev rule: 80-drivers-modprobe.rules
144
-*** Including module: ostree ***
145
-*** Including module: systemd ***
146
-*** Including module: usrmount ***
147
-*** Including module: base ***
148
-/etc/os-release: line 1: Photon: command not found
149
-*** Including module: fs-lib ***
150
-*** Including module: shutdown ***
151
-*** Including modules done ***
152
-*** Installing kernel module dependencies and firmware ***
153
-*** Installing kernel module dependencies and firmware done ***
154
-*** Resolving executable dependencies ***
155
-*** Resolving executable dependencies done***
156
-*** Stripping files ***
157
-*** Stripping files done ***
158
-*** Store current command line parameters ***
159
-*** Creating image file ***
160
-*** Creating image file done ***
161
-Image: /var/tmp/initramfs.img: 11M
162
-========================================================================
163
-Version: dracut-041-1.ph1
164
-
165
-Arguments: -v --tmpdir '/tmp' -f --no-hostonly
166
-
167
-dracut modules:
168
-bash
169
-kernel-modules
170
-resume
171
-rootfs-block
172
-terminfo
173
-udev-rules
174
-ostree
175
-systemd
176
-usrmount
177
-base
178
-fs-lib
179
-shutdown
180
-========================================================================
181
-drwxr-xr-x  12 root     root            0 Sep  1 00:52 .
182
-crw-r--r--   1 root     root       5,   1 Sep  1 00:52 dev/console
183
-crw-r--r--   1 root     root       1,  11 Sep  1 00:52 dev/kmsg
184
-...   (long list of files removed)
185
-========================================================================
186
-Initializing rootfs
187
-Migrating /etc/passwd to /usr/lib/
188
-Migrating /etc/group to /usr/lib/
189
-Moving /usr to target
190
-Linking /usr/local -> ../var/usrlocal
191
-Moving /etc to /usr/etc
192
-Placing RPM db in /usr/share/rpm
193
-Ignoring non-directory/non-symlink '/var/tmp/rpm-ostree.TVO089/rootfs.tmp/var/lib/nss_db/Makefile'
194
-Ignoring non-directory/non-symlink '/var/tmp/rpm-ostree.TVO089/rootfs.tmp/var/cache/ldconfig/aux-cache'
195
-Ignoring non-directory/non-symlink '/var/tmp/rpm-ostree.TVO089/rootfs.tmp/var/log/btmp'
196
-Ignoring non-directory/non-symlink '/var/tmp/rpm-ostree.TVO089/rootfs.tmp/var/log/lastlog'
197
-Ignoring non-directory/non-symlink '/var/tmp/rpm-ostree.TVO089/rootfs.tmp/var/log/wtmp'
198
-Moving /boot
199
-Using boot location: both
200
-Copying toplevel compat symlinks
201
-Adding tmpfiles-ostree-integration.conf
202
-Committing '/var/tmp/rpm-ostree.TVO089/rootfs.tmp' ...
203
-photon/1.0/x86_64/minimal => c505f4bddb4381e8b5213682465f1e5bb150a18228aa207d763cea45c6a81bbe
204
-```
205
-I've cut a big part of logging, but as you can see, the new filetree adds to the top of the previous (initial) commit 2940e10c4d and produces a new commit c505f4bddb. Our packages gawk-4.1.0-2.ph1.x86_64, sudo-1.8.11p1-4.ph1.x86_64 and wget-1.15-1.ph1.x86_64 have been added.  
206
-
207
-During compose, `rpm-ostree` checks out the file tree into its uncompressed form, applies the package changes, places the updated RPM repo into /usr/share/rpm  and calls `ostree` to commit its changes back into the OSTree repo. If we were to look at the temp directory during this time:
208
-```
209
-root [ /srv/rpm-ostree ]# ls /var/tmp/rpm-ostree.TVO089/rootfs.tmp
210
-bin   dev   lib    media  opt     proc  run   srv  sysroot  usr
211
-boot  home  lib64  mnt    ostree  root  sbin  sys  tmp      var
212
-```
213
-If we repeat the command, and there is no change in the JSON file settings and no change in metadata, rpm-ostree will figure out that nothing has changed and stop. You can force however to redo the whole composition.
214
-```
215
-root [ /srv/rpm-ostree ]# rpm-ostree compose tree --repo=repo photon-base.json
216
-Previous commit: c505f4bddb4381e8b5213682465f1e5bb150a18228aa207d763cea45c6a81bbe
217
-
218
-Downloading metadata [=========================================================================] 100%
219
-
220
-
221
-No apparent changes since previous commit; use --force-nocache to override
222
-```
223
-
224
-This takes several minutes. Then why is the RPM-OSTree server installing so fast, in 45 seconds on my SSD? The server doesn't compose the tree, it uses a pre-created OSTree repo that is stored on the CD-ROM. It comes of course at the expense of larger CD-ROM size. This OSTree repo is created from the same set of RPMS on the CD-ROM, so if you compose fresh, you will get the same exact tree, with same commit ID for the "minimal" ref. 
225
-
226
-
227
-## 9.5 Automatic version prefix
228
-If you recall the filetree version explained earlier, this is where it comes into play. When a tree is composed from scratch, the first version (0) associated to the initial commit is going to get that human readable value. Any subsequent compose operation will auto-increment to .1, .2, .3 and so on.  
229
-It's a good idea to start a versionning scheme of your own, so that your customized Photon builds that may get different packages of your choice don't get the same version numbers as the official Photon team builds, coming from VMware's bintray OSTree repository. There is no conflict, it's just confusing to have same name for different commits coming from different repos!  
230
-So if you work for a company named Big Data Inc., you may want to switch to a new versioning scheme `"automatic_version_prefix": "1.0_bigdata"`.
231
-
232
-
233
-## 9.6 Installing package updates
234
-If you want to provide hosts with the package updates that VMware periodically releases, all that you need to do is to add the photon-updates.repo to the list of repos in photon-base.json and then re-compose the usual way. 
235
-```
236
-"repos": ["photon", "photon-updates"],
237
-```
238
-
239
-Even though you may have not modified the "packages" section in the json file, the newer versions of existing packages will be included in the new image and then downloaded by the host the usual way. Note that upgrading a package shows differently than adding (+) or removing (-). You may still see packages added (or removed) though because they are new dependencies (or no longer dependencies) for the newer versions of other packages, as libssh2 in the example below.
240
-```
241
-root [ ~ ]# rpm-ostree upgrade --check-diff
242
-Updating from: photon:photon/1.0/x86_64/minimal
243
-
244
-8 metadata, 13 content objects fetched; 1002 KiB transferred in 0 seconds
245
-!bridge-utils-1.5-2.ph1.x86_64
246
-=bridge-utils-1.5-3.ph1.x86_64
247
-!bzip2-1.0.6-5.ph1.x86_64
248
-=bzip2-1.0.6-6.ph1.x86_64
249
-!curl-7.47.1-2.ph1.x86_64
250
-=curl-7.51.0-2.ph1.x86_64
251
-!docker-1.11.0-5.ph1.x86_64
252
-=docker-1.12.1-1.ph1.x86_64
253
-...
254
-+libssh2-1.8.0-1.ph1.x86_64
255
-...
256
-
257
-root [ ~ ]# rpm-ostree upgrade             
258
-Updating from: photon:photon/1.0/x86_64/minimal
259
-
260
-258 metadata, 1165 content objects fetched; 76893 KiB transferred in 8 seconds
261
-Copying /etc changes: 6 modified, 0 removed, 14 added
262
-Transaction complete; bootconfig swap: yes deployment count change: 1
263
-Changed:
264
-  bridge-utils 1.5-2.ph1 -> 1.5-3.ph1
265
-  bzip2 1.0.6-5.ph1 -> 1.0.6-6.ph1
266
-  curl 7.47.1-2.ph1 -> 7.51.0-2.ph1
267
-  docker 1.11.0-5.ph1 -> 1.12.1-1.ph1
268
-  ...
269
-Added:
270
-  libssh2-1.8.0-1.ph1.x86_64
271
-Upgrade prepared for next boot; run "systemctl reboot" to start a reboot
272
-```
273
-
274
-Now if we want to see what packages have been updated and what issues have been fixed, just run at the host the command that we learned about in chapter 5.4.
275
-
276
-```
277
-root [ ~ ]# rpm-ostree db diff 56ef 396e
278
-ostree diff commit old: 56e (56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4)
279
-ostree diff commit new: 396 (396e1116ad94692b8c105edaee4fa12447ec3d8f73c7b3ade4e955163d517497)
280
-Upgraded:
281
- bridge-utils-1.5-3.ph1.x86_64
282
-* Mon Sep 12 2016 Alexey Makhalov <amakhalov@vmware.com> 1.5-3
283
--	Update patch to fix-2.
284
-
285
- bzip2-1.0.6-6.ph1.x86_64
286
-* Fri Oct 21 2016 Kumar Kaushik <kaushikk@vmware.com> 1.0.6-6
287
--       Fixing security bug CVE-2016-3189.
288
-
289
- curl-7.51.0-2.ph1.x86_64
290
-* Wed Nov 30 2016 Xiaolin Li <xiaolinl@vmware.com> 7.51.0-2
291
--   Enable sftp support.
292
-
293
-* Wed Nov 02 2016 Anish Swaminathan <anishs@vmware.com> 7.51.0-1
294
--   	Upgrade curl to 7.51.0
295
-
296
-* Thu Oct 27 2016 Anish Swaminathan <anishs@vmware.com> 7.47.1-4
297
--   	Patch for CVE-2016-5421
298
-
299
-* Mon Sep 19 2016 Xiaolin Li <xiaolinl@vmware.com> 7.47.1-3
300
--   	Applied CVE-2016-7167.patch.
301
-
302
- docker-1.12.1-1.ph1.x86_64
303
-* Wed Sep 21 2016 Xiaolin Li <xiaolinl@vmware.com> 1.12.1-1
304
--   Upgraded to version 1.12.1
305
-
306
-* Mon Aug 22 2016 Alexey Makhalov <amakhalov@vmware.com> 1.12.0-2
307
--   Added bash completion file
308
-
309
-* Tue Aug 09 2016 Anish Swaminathan <anishs@vmware.com> 1.12.0-1
310
--   Upgraded to version 1.12.0
311
-
312
-* Tue Jun 28 2016 Anish Swaminathan <anishs@vmware.com> 1.11.2-1
313
--   Upgraded to version 1.11.2
314
-...
315
-Added:
316
- libssh2-1.8.0-1.ph1.x86_64
317
-``` 
318
-
319
-## 9.7 Composing for a different branch
320
-RPM-OSTree makes it very easy to create and update new branches, by composing using json config files that include the Refspec as the new branch name, the list of packages and the other settings we are now familiar with.  Photon OS 2.0 RPM-OSTRee Server installer adds two extra files photon-minimal.json and photon-full.json in addition to photon-base.json, that correspond almost identically to the minimal and full profiles installed via tdnf. It also makes 'photon-base' a smaller set of starter branch.  
321
-Of course, you can create your own config files for your branches with desired lists of packages. You may compose on top of the existing tree, or you can [start fresh your own OSTRee repo](Photon-RPM-OSTree-8-File-oriented-server-operations.md#81-starting-a-fresh-ostree-repo), using your own customized versioning.
322 1
deleted file mode 100644
... ...
@@ -1,52 +0,0 @@
1
-# Appendix
2
-
3
-## Photon 1.0 GA: systemd-networkd and systemd-resolved not starting in the updated image, on reboot
4
-This issue has been fixed in 1.0 Revision 2 and above.
5
-If you compose a custom image at the server, download at the RPM-OSTree host the updated image and reboot, systemd-networkd may report an access denied error, in which case your network interface is not properly configured, and ifconfig will not list an external IP address. This is a bug that was discovered very late and we didn't have time to address it for Photon 1.0. The easy workaround is to temporary relax the server permissions before  composing the tree (image) and revert back to the secure umask after that. Here are the steps to recover, that work even after you've already composed a "bad" image and some hosts have downloaded and booted into it:  
6
-At server:  
7
-  1. Execute **umask 022**.  
8
-  2. Execute **rpm-ostree compose tree --force-nocache ...** to create a new, good image.  
9
-  3. Execute **umask 027** to tighten back the server permissions as good security practice.  
10
-
11
-At every host that booted into the bad image, from console:  
12
-  1. Execute **rpm-ostree rollback**, then reboot into the older good image.  
13
-  2. Login after reboot, then execute **rpm-ostree upgrade** to download the new, good image from server. It's going to skip the bad image version.  
14
-  3. Reboot into new good image and execute ifconfig, notice you now have an external IP address. Also, your host will have the recommended secure umask 0027 set.
15
- 
16
-## OSTree repo is no longer accessible via http after RPM-OSTree server has updated httpd package
17
-If server itself is updated via tdnf that brings a newer version of httpd package, httpd.service file will be overwritten to a default value (not valid for OSTree repo), and hosts trying to install or upgrade will report an "invalid or missing config".  To fix the problem:  
18
-
19
-* Replace the content of /usr/lib/systemd/system/httpd.service with:
20
-```
21
-[Unit]
22
-Description=The Apache HTTP Server
23
-After=network.target remote-fs.target nss-lookup.target
24
-
25
-[Service]
26
-Type=forking
27
-ExecStart=/usr/sbin/httpd -f /srv/rpm-ostree/ostree-httpd.conf -DFORGROUND
28
-ExecReload=/usr/sbin/httpd -f /srv/rpm-ostree/ostree-httpd.conf -k graceful
29
-KillSignal=SIGWINCH
30
-KillMode=mixed
31
-Restart=always
32
-
33
-[Install]
34
-WantedBy=multi-user.target
35
-```
36
-* systemctl daemon-reload
37
-* systemctl restart httpd
38
-
39
-## Error composing when photon-iso repo is selected
40
-If you are doing the trick explained in 9.3 to speed up composing by getting the RPMS from cdrom instead of the online repo, you may encounter an **error: cache too old:**. We are investigating - it could be an rpm-ostree bug or some incompatibility between the caching in tdnf vs. libhif used by ostree, but meanwhile just leave **"repos": ["photon"],** in photon-base.json.  
41
-  
42
-## Package differences between RPM-OSTree "minimal" and minimal installation profile
43
-This is not an actual issue, I'm only mentioning because of naming - people may expect that installing an RPM-OSTree host using the **photon/1.0/x86_64/minimal** reftag will create an exact equivalent, albeit read-only replica of the Photon minimal, when in fact you get fewer packages. That is because we were constrained by size of the starter ostree repo included on the cdrom, needed in order to install fast the server and the default host, yet still small enough for the ISO installer to run in 384 MB RAM in Fusion and Workstation, 512 MB in ESX.
44
-
45
-That's easy to overcome - just add the wanted package names in the photon-base.json and re-compose the tree.
46
-
47
-
48
-
49
-## Manual pages not included for installed packages
50
-The packages in photon-base.json don't have their manual pages installed. This is for the same reason - keep the cdrom included ostree repo size small. If the manual pages are desired, just change to true the **documentation** setting in photon-base.json and re-compose.
51
-
52
-
53 1
deleted file mode 100644
... ...
@@ -1,196 +0,0 @@
1
-# Install or rebase to Photon OS 2.0
2
-
3
-Photon OS 2.0 release has a different focus and while it provides full RPM-OSTree functionality (updated to 2017), it lets the user drive it, rather than provide a pre-defined solution as part of the installation.  
4
-
5
-The number of packages included in the RPMS repo in Photon OS 2.0 increased significantly, compared to 1.0. To keep the ISO at reasonable size, Photon OS 2.0 no longer includes the compressed ostree.repo file, that helped optimize both the server and host install in 1.0 or 1.0 Rev2. That decision affected the OSTree features we ship out of the box. Customer could achieve the same results by several additional simple steps, that will be explained in this chapter. In addition, there is a new way to create a host raw image at server.
6
-
7
-## 12.1 Installing an RPM-OSTree server
8
-Photon OS 2.0 installer contains an option to install an OSTree server, just like Photon 1.0 OS does. It will not run, however, the server 'compose tree' as part of installation, as most users will want to start from scratch to create their own image anyway, using different package set and customized settings.
9
-In addition to starter photon-base.json, we provide photon-minimal.json and photon-full.json, updated with a 2.0 Refspec. We still fire up an Apache web server, that will point to an empty site initially at the repo directory. Assuming you've customized photon-base.json to you liking, all you need to do is to run the commands you are already familiar with from [Chapter 9](Photon-RPM-OSTree-9-Package-oriented-server-operations.md).
10
-```
11
-root [ /srv/rpm-ostree ]# ostree --repo=repo init --mode=archive-z2
12
-root [ /srv/rpm-ostree ]# rpm-ostree compose tree --repo=repo photon-base.json
13
-```
14
-Now if you point a browser to http://<server_IP_address>, you should see the familiar directory structure of an OSTree repo.
15
-
16
-## 12.2 Installing an RPM-OSTree host
17
-Photon OS 2.0 installer no longer includes a UI option to deploy a host manually - either against a default or a custom server repo, and also there is no official online Photon OS 2.0 OSTree repo published. This is now completely customer driven.  
18
-Automated host install is supported, as explained in [Chapter 7.2 Automated install of a custom host via kickstart](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md#72-automated-install-of-a-custom-host-via-kickstart).  
19
-
20
-## 12.3 Rebasing a host from Photon 1.0 to 2.0
21
-If kickstart sounds too complicated and we still want to go the UI way like in 1.0, fortunately, there is a workaround that requires an extra step. Also, if you have an installed Photon 1.0 or 1.0 Rev2 that you want to carry to 2.0, you need to rebase it. Notice that I didn't say "upgrade".   
22
-
23
-Basically the OSTree repo will switch to a different branch on a different server, following the new server's branch versioning scheme. The net result is that the lots of packages will get changed to newer versions from newer OSTree repo, that has been composed from a newer Photon OS 2.0 RPMS repo. Again, I didn't say "upgraded", neither the rebase command output, that lists "changed" packages. Some obsolete packages will be removed, new packages will be added, either because they didn't exist in 1.0 repo, or because the new config file includes them.  
24
-The OS name is the same (Photon), so the content in /var and /etc will be transferred over.  
25
-
26
-1. To install fresh, deploy a Photon 1.0 Rev2 host default, as described in [Chapter 2](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md). Of course, if you already have an existing Photon OS 1.0 host that you want to move to 2.0, skip this step.
27
-2. Edit /ostree/repo/config and substitute the url, providing the IP address for the Photon OS 2.0 RPM-OSTree server installed above. This was explained in [Chapter 10](Photon-RPM-OSTree-10-Remotes.md#102-switching-repositories).  
28
-ostree should confirm that is the updated server IP for the "photon" remote.
29
-
30
-    ```
31
-    root@ostree-host [ ~ ]# ostree remote show-url photon
32
-    http://10.118.101.180
33
-    ```
34
-3. Rebase your host to the new 2.0 server and Refspec.
35
- 
36
-```
37
-root@ostree-host [ ~ ]# rpm-ostree rebase photon/2.0/x86_64/minimal
38
-549 metadata, 2654 content objects fetched; 119853 KiB transferred in 17 seconds
39
-Copying /etc changes: 6 modified, 0 removed, 14 added
40
-Transaction complete; bootconfig swap: yes deployment count change: 1
41
-Deleting ref 'photon:photon/1.0/x86_64/minimal'
42
-Changed:
43
-  Linux-PAM 1.2.1-3.ph1 -> 1.3.0-1.ph2
44
-  attr 2.4.47-3.ph1 -> 2.4.47-4.ph2
45
-  autogen-libopts 5.18.7-2.ph1 -> 5.18.12-2.ph2
46
-  bash 4.3.30-4.ph1 -> 4.4-5.ph2
47
-  bc 1.06.95-3.ph1 -> 1.06.95-3.ph2
48
-  binutils 2.25.1-2.ph1 -> 2.29-3.ph2
49
-  bridge-utils 1.5-3.ph1 -> 1.6-1.ph2
50
-  bzip2 1.0.6-6.ph1 -> 1.0.6-8.ph2
51
-  ca-certificates 20160109-5.ph1 -> 20170406-3.ph2
52
-  coreutils 8.25-2.ph1 -> 8.27-2.ph2
53
-  cpio 2.12-2.ph1 -> 2.12-3.ph2
54
-  cracklib 2.9.6-2.ph1 -> 2.9.6-8.ph2
55
-  cracklib-dicts 2.9.6-2.ph1 -> 2.9.6-8.ph2
56
-  curl 7.51.0-2.ph1 -> 7.54.1-1.ph2
57
-  dbus 1.8.8-5.ph1 -> 1.11.12-1.ph2
58
-  device-mapper 2.02.141-5.ph1 -> 2.02.171-3.ph2
59
-  device-mapper-libs 2.02.141-5.ph1 -> 2.02.171-3.ph2
60
-  docker 1.12.1-1.ph1 -> 17.06.0-1.ph2
61
-  dracut 044-3.ph1 -> 045-4.ph2
62
-  dracut-tools 044-3.ph1 -> 045-4.ph2
63
-  elfutils-libelf 0.165-2.ph1 -> 0.169-1.ph2
64
-  expat 2.2.0-1.ph1 -> 2.2.0-2.ph2
65
-  file 5.24-2.ph1 -> 5.30-2.ph2
66
-  filesystem 1.0-8.ph1 -> 1.0-13.ph2
67
-  findutils 4.6.0-2.ph1 -> 4.6.0-3.ph2
68
-  flex 2.5.39-3.ph1 -> 2.6.4-2.ph2
69
-  glib 2.47.6-2.ph1 -> 2.52.1-2.ph2
70
-  glib-networking 2.46.1-2.ph1 -> 2.50.0-1.ph2
71
-  glibc 2.22-9.ph1 -> 2.26-1.ph2
72
-  gmp 6.0.0a-3.ph1 -> 6.1.2-2.ph2
73
-  gnutls 3.4.11-2.ph1 -> 3.5.10-1.ph2
74
-  gobject-introspection 1.46.0-2.ph1 -> 1.52.1-4.ph2
75
-  gpgme 1.6.0-2.ph1 -> 1.9.0-2.ph2
76
-  grep 2.21-2.ph1 -> 3.0-3.ph2
77
-  grub2 2.02-5.ph1 -> 2.02-9.ph2
78
-  gzip 1.6-2.ph1 -> 1.8-1.ph2
79
-  iana-etc 2.30-2.ph1 -> 2.30-2.ph2
80
-  iproute2 4.2.0-2.ph1 -> 4.10.0-3.ph2
81
-  iptables 1.6.0-5.ph1 -> 1.6.1-4.ph2
82
-  json-glib 1.0.4-2.ph1 -> 1.2.8-1.ph2
83
-  kmod 21-4.ph1 -> 24-3.ph2
84
-  krb5 1.14-4.ph1 -> 1.15.1-2.ph2
85
-  libarchive 3.1.2-7.ph1 -> 3.3.1-1.ph2
86
-  libassuan 2.4.2-2.ph1 -> 2.4.3-1.ph2
87
-  libcap 2.25-2.ph1 -> 2.25-7.ph2
88
-  libffi 3.2.1-2.ph1 -> 3.2.1-5.ph2
89
-  libgcc 5.3.0-3.ph1 -> 6.3.0-3.ph2
90
-  libgcrypt 1.6.5-2.ph1 -> 1.7.6-1.ph2
91
-  libgomp 5.3.0-3.ph1 -> 6.3.0-3.ph2
92
-  libgpg-error 1.21-2.ph1 -> 1.27-1.ph2
93
-  libgsystem 2015.1-2.ph1 -> 2015.2-1.ph2
94
-  librepo 1.7.17-2.ph1 -> 1.7.20-2.ph2
95
-  libselinux 2.5-2.ph1 -> 2.6-4.ph2
96
-  libsepol 2.5-2.ph1 -> 2.6-1.ph2
97
-  libsolv 0.6.19-2.ph1 -> 0.6.26-3.ph2
98
-  libsoup 2.53.90-2.ph1 -> 2.57.1-2.ph2
99
-  libssh2 1.8.0-1.ph1 -> 1.8.0-1.ph2
100
-  libstdc++ 5.3.0-3.ph1 -> 6.3.0-3.ph2
101
-  libtasn1 4.7-3.ph1 -> 4.10-1.ph2
102
-  libtool 2.4.6-2.ph1 -> 2.4.6-3.ph2
103
-  libxml2 2.9.4-3.ph1 -> 2.9.4-11.ph2
104
-  linux 4.4.41-1.ph1 -> 4.9.43-2.ph2
105
-  m4 1.4.17-2.ph1 -> 1.4.18-1.ph2
106
-  mkinitcpio 19-2.ph1 -> 23-3.ph2
107
-  mpfr 3.1.3-2.ph1 -> 3.1.5-1.ph2
108
-  ncurses 6.0-2.ph1 -> 6.0-10.ph2
109
-  net-tools 1.60-7.ph1 -> 1.60-10.ph2
110
-  nettle 3.2-2.ph1 -> 3.3-1.ph2
111
-  nspr 4.12-2.ph1 -> 4.15-1.ph2
112
-  nss-altfiles 2.19.1-2.ph1 -> 2.23.0-1.ph2
113
-  openssh 7.4p1-1.ph1 -> 7.5p1-4.ph2
114
-  openssl 1.0.2j-1.ph1 -> 1.0.2l-1.ph2
115
-  ostree 2015.7-5.ph1 -> 2017.5-1.ph2
116
-  pcre 8.39-1.ph1 -> 8.40-4.ph2
117
-  photon-release 1.0-6.ph1 -> 2.0-1.ph2
118
-  pkg-config 0.28-2.ph1 -> 0.29.2-1.ph2
119
-  popt 1.16-2.ph1 -> 1.16-4.ph2
120
-  procps-ng 3.3.11-3.ph1 -> 3.3.12-2.ph2
121
-  readline 6.3-4.ph1 -> 7.0-2.ph2
122
-  rpm-ostree 2015.7-2.ph1 -> 2017.5-1.ph2
123
-  sed 4.2.2-2.ph1 -> 4.4-2.ph2
124
-  shadow 4.2.1-8.ph1 -> 4.2.1-13.ph2
125
-  systemd 228-32.ph1 -> 233-7.ph2
126
-  util-linux 2.27.1-2.ph1 -> 2.29.2-3.ph2
127
-  vim 7.4-6.ph1 -> 8.0.0533-3.ph2
128
-  which 2.21-2.ph1 -> 2.21-3.ph2
129
-  xz 5.2.2-2.ph1 -> 5.2.3-2.ph2
130
-  zlib 1.2.8-3.ph1 -> 1.2.11-1.ph2
131
-Removed:
132
-  db-6.1.26-2.ph1.x86_64
133
-  e2fsprogs-1.42.13-2.ph1.x86_64
134
-  gdbm-1.11-2.ph1.x86_64
135
-  hawkey-2014.1-4.ph1.x86_64
136
-  iputils-20151218-3.ph1.x86_64
137
-  libhif-0.2.2-2.ph1.x86_64
138
-  lua-5.3.2-2.ph1.x86_64
139
-  nss-3.25-1.ph1.x86_64
140
-  python2-2.7.11-8.ph1.x86_64
141
-  python2-libs-2.7.11-8.ph1.x86_64
142
-  rpm-4.11.2-11.ph1.x86_64
143
-  sqlite-autoconf-3.11.0-2.ph1.x86_64
144
-  tcsh-6.19.00-4.ph1.x86_64
145
-Added:
146
-  bubblewrap-0.1.8-1.ph2.x86_64
147
-  bzip2-libs-1.0.6-8.ph2.x86_64
148
-  ca-certificates-pki-20170406-3.ph2.x86_64
149
-  curl-libs-7.54.1-1.ph2.x86_64
150
-  e2fsprogs-libs-1.43.4-2.ph2.x86_64
151
-  expat-libs-2.2.0-2.ph2.x86_64
152
-  fuse-2.9.7-2.ph2.x86_64
153
-  gnupg-2.1.20-2.ph2.x86_64
154
-  libdb-5.3.28-1.ph2.x86_64
155
-  libksba-1.3.5-1.ph2.x86_64
156
-  libltdl-2.4.6-3.ph2.x86_64
157
-  libseccomp-2.3.2-1.ph2.x86_64
158
-  ncurses-libs-6.0-10.ph2.x86_64
159
-  ncurses-terminfo-6.0-10.ph2.x86_64
160
-  npth-1.3-1.ph2.x86_64
161
-  nss-libs-3.31-2.ph2.x86_64
162
-  openssh-clients-7.5p1-4.ph2.x86_64
163
-  openssh-server-7.5p1-4.ph2.x86_64
164
-  pcre-libs-8.40-4.ph2.x86_64
165
-  pinentry-1.0.0-2.ph2.x86_64
166
-  rpm-libs-4.13.0.1-5.ph2.x86_64
167
-  sqlite-libs-3.19.3-1.ph2.x86_64
168
-  util-linux-libs-2.29.2-3.ph2.x86_64
169
-  xz-libs-5.2.3-2.ph2.x86_64
170
-
171
-root@ostree-host [ ~ ]# rpm-ostree status
172
-  TIMESTAMP (UTC)         VERSION           ID             OSNAME     REFSPEC                              
173
-  2017-08-31 18:19:36     2.0_minimal       f4497b1948     photon     photon:photon/2.0/x86_64/minimal
174
-* 2017-01-11 02:18:42     1.0_minimal.1     4a21972b29     photon     photon:photon/1.0/x86_64/minimal
175
-```
176
-
177
-That's it! You may now reboot to the new Photon OS 2.0 image. The updated ostree and rpm-ostree packages have a slightly changed output format:
178
-
179
-```
180
-root@ph2-ostree-host [ ~ ]# rpm-ostree status
181
-State: idle
182
-Deployments:
183
-* photon:photon/2.0/x86_64/minimal
184
-             Version: 2.0_minimal (2017-08-31 18:19:36)
185
-              Commit: f4497b194826adb0db6e17a6867df04edd1dc1ebe796a73db9f19b973b5658df
186
-
187
-  photon:photon/1.0/x86_64/minimal
188
-             Version: 1.0_minimal.1 (2017-01-11 02:18:42)
189
-              Commit: 4a21972b293978d39777017ccb33dde45713dd435b3cb77ee42161e7e849e5e4
190
-```
191
-
192
-There are some side effects of installing Photon OS 2.0 based on the skeleton of a 1.0. For one, the custom disk partitioning is not available in 1.0. There could be others, I cannot think of now.
193
-
194
-## 12.4 Creating a host raw image
195
-It is now possible to run at server a script that is part of RPM-OStree package, to create a host raw mage.
196
-
197 1
deleted file mode 100644
... ...
@@ -1,82 +0,0 @@
1
-# Photon RPM OSTree: a simple guide
2
-
3
-## Contents  
4
-***
5
-
6
-
7
-1. [Introduction](Photon-RPM-OSTree-1-Introduction.md)  
8
-  1. [What is OSTree? How about RPM-OSTree?](Photon-RPM-OSTree-1-Introduction.md#11-what-is-ostree-how-about-rpm-ostree)
9
-  1. [Why use RPM-OSTree in Photon?](Photon-RPM-OSTree-1-Introduction.md#12-why-use-rpm-ostree-in-photon)
10
-  1. [Photon with RPM-OSTree installation profiles](Photon-RPM-OSTree-1-Introduction.md#13-photon-with-rpm-ostree-installation-profiles)
11
-  1. [Terminology](Photon-RPM-OSTree-1-Introduction.md#14-terminology)
12
-  1. [Sample code](Photon-RPM-OSTree-1-Introduction.md#15-sample-code)
13
-  1. [How to read this book](Photon-RPM-OSTree-1-Introduction.md#16-how-to-read-this-book)
14
-  1. [RPM-OSTree in Photon OS 2.0](Photon-RPM-OSTree-1-Introduction.md#17-rpm-ostree-in-photon-os-20)
15
-2. [Installing a Photon RPM-OSTree host against default server repository](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md)  
16
-    1. [Who is this for?](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md#21-who-is-this-for)
17
-    1. [Installing the ISO, step by step](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md#22-installing-the-iso-step-by-step)
18
-3. [Concepts in action](Photon-RPM-OStree-3-Concepts-in-action.md)  
19
-    1. [Querying the deployed filetrees](Photon-RPM-OStree-3-Concepts-in-action.md#31-querying-the-deployed-filetrees)
20
-    1. [Bootable filetree version](Photon-RPM-OStree-3-Concepts-in-action.md#32-bootable-filetree-version)
21
-    1. [Commit ID](Photon-RPM-OStree-3-Concepts-in-action.md#33-commit-id)
22
-    1. [OSname](Photon-RPM-OStree-3-Concepts-in-action.md#34-osname)
23
-    1. [Refspec](Photon-RPM-OStree-3-Concepts-in-action.md#35-refspec)
24
-    1. [Deployments](Photon-RPM-OStree-3-Concepts-in-action.md#36-deployments)
25
-4. [Querying for commit, file and package metadata](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md)  
26
-    1. [Commit history](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#41-commit-history)
27
-    1. [Listing file mappings](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#42-listing-file-mappings)
28
-    1. [Listing configuration changes](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#43-listing-configuration-changes)
29
-    1. [Listing packages](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#44-listing-packages)
30
-    1. [Querying for package details](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#45-querying-for-package-details)
31
-    1. [Why am I unable to install, update or delete packages?](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#46-why-am-i-unable-to-install-update-or-delete-packages)
32
-5. [Host updating operations](Photon-RPM-OSTree-5-Host-updating-operations.md)  
33
-    1. [Is it an update or an upgrade?](Photon-RPM-OSTree-5-Host-updating-operations.md#51-is-it-an-update-or-an-upgrade)
34
-    1. [Incremental upgrade](Photon-RPM-OSTree-5-Host-updating-operations.md#52-incremental-upgrade)
35
-    1. [Listing file differences](Photon-RPM-OSTree-5-Host-updating-operations.md#53-listing-file-differences)
36
-    1. [Listing package differences](Photon-RPM-OSTree-5-Host-updating-operations.md#54-listing-package-differences)
37
-    1. [Rollback](Photon-RPM-OSTree-5-Host-updating-operations.md#55-rollback)
38
-    1. [Deleting a deployed filetree](Photon-RPM-OSTree-5-Host-updating-operations.md#56-deleting-a-deployed-filetree)
39
-    1. [Version skipping upgrade](Photon-RPM-OSTree-5-Host-updating-operations.md#57-version-skipping-upgrade)
40
-    1. [Tracking parent commits](Photon-RPM-OSTree-5-Host-updating-operations.md#58-tracking-parent-commits)
41
-    1. [Resetting a branch to a previous commit](Photon-RPM-OSTree-5-Host-updating-operations.md#59-resetting-a-branch-to-a-previous-commit)
42
-6. [Installing a Photon RPM-OSTree server](Photon-RPM-OSTree-6-Installing-a-server.md)  
43
-    1. [Manual install of a server](Photon-RPM-OSTree-6-Installing-a-server.md#61-manual-install-of-a-server)
44
-    1. [Composing your first OSTree repo](Photon-RPM-OSTree-6-Installing-a-server.md#62-composing-your-first-ostree-repo)
45
-    1. [Automated install of a server via kickstart](Photon-RPM-OSTree-6-Installing-a-server.md#63-automated-install-of-a-server-via-kickstart)
46
-7. [Installing a Photon RPM-OStree host against a custom server repository](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md)  
47
-    1. [Manual install of a custom host](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md#71-manual-install-of-a-custom-host)
48
-    1. [Automated install of a custom host via kickstart](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md#72-automated-install-of-a-custom-host-via-kickstart)
49
-8. [File oriented server operations](Photon-RPM-OStree-8-File-oriented-server-operations.md)
50
-    1. [Starting a fresh OSTree repo](Photon-RPM-OStree-8-File-oriented-server-operations.md#81-starting-a-fresh-ostree-repo)
51
-    1. [Checking out a filetree](Photon-RPM-OStree-8-File-oriented-server-operations.md#82-checking-out-a-filetree)
52
-    1. [Committing changes to a filetree](Photon-RPM-OStree-8-File-oriented-server-operations.md#83-committing-changes-to-a-filetree)
53
-    1. [Downloading the changes at the host](Photon-RPM-OStree-8-File-oriented-server-operations.md#84-downloading-the-changes-at-the-host)
54
-    1. [Creating summary metadata](Photon-RPM-OStree-8-File-oriented-server-operations.md#85-creating-summary-metadata)
55
-9. [Package oriented server operations](Photon-RPM-OSTree-9-Package-oriented-server-operations.md)  
56
-    1. [JSON configuration file](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#91-json-configuration-file)
57
-    1. [Package addition, removal, upgrade](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#92-package-addition-removal-upgrade)
58
-    1. [RPMS repository](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#93-rpms-repository)
59
-    1. [Composing a tree](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#94-composing-a-tree)
60
-    1. [Automatic version prefix](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#95-automatic-version-prefix)
61
-    1. [Installing package updates](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#96-installing-package-updates)
62
-    1. [Composing for a different branch](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#97-composing-for-a-different-branch)
63
-10. [Remotes](Photon-RPM-OSTree-10-Remotes.md)  
64
-    1. [Listing remotes](Photon-RPM-OSTree-10-Remotes.md#101-listing-remotes)
65
-    1. [GPG signature verification](Photon-RPM-OSTree-10-Remotes.md#102-gpg-signature-verification)
66
-    1. [Switching repositories](Photon-RPM-OSTree-10-Remotes.md#103-switching-repositories)
67
-    1. [Adding and removing remotes](Photon-RPM-OSTree-10-Remotes.md#104-adding-and-removing-remotes)
68
-    1. [List available branches](Photon-RPM-OSTree-10-Remotes.md#105-list-available-branches)
69
-11. [Running container applications between bootable images](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md)  
70
-    1. [Downloading a docker container appliance](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md#111-downloading-a-docker-container-appliance)
71
-    1. [Rebooting into an existing image](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md#112-rebooting-into-an-existing-image)
72
-    1. [Reboot into a newly created image](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md#113-reboot-into-a-newly-created-image)
73
-12. [Install or rebase to Photon OS 2.0](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md)  
74
-    1. [Installing an RPM-OSTree server](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#121-installing-an-rpm-ostree-server)
75
-    1. [Installing an RPM-OSTree host](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#122-installing-an-rpm-ostree-host)
76
-    1. [Rebasing a host from Photon 1.0 to 2.0](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#123-rebasing-a-host-from-photon-10-to-20)
77
-    1. [Creating a host raw image](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#124-creating-a-host-raw-image)
78
-
79
-[Appendix A: Known issues](Photon-RPM-OSTree-Appendix-A-Known-issues.md)  
80
-
81
-
82
-
83 1
deleted file mode 100644
... ...
@@ -1,115 +0,0 @@
1
-# Concepts in Action
2
-
3
-Now that we have a fresh installed host (either as [[default|Photon-RPM-OSTree:-2-Installing-a-host-against-default-server-repository]] or [[custom|Photon-RPM-OSTree:-7-Installing-a-host-against-a-custom-server-repository]]), I can explain better the OStree concepts and see them in action.  
4
-## 3.1 Querying the deployed filetrees
5
-The first thing to do is to run a command that tells us what is installed on the machine and when. Since it's a fresh install from the CD, there is only one bootable filetree image deployed.
6
-``` 
7
-root@photon-host [ ~ ]# rpm-ostree status
8
-  TIMESTAMP (UTC)       VERSION       ID           OSNAME  REFSPEC               
9
-* 2016-06-07 14:06:17   1.0_minimal   56ef687f13   photon  photon:photon/1.0/x86_64/minimal
10
-```  
11
-## 3.2 Bootable filetree version
12
-**1.0_minimal** is not the Linux Photon OS release version, nor daily build, but rather a human readable, self-incrementing version associated with every commit that brings file/package updates. Think of this as version 0. The following versions are going to be 1.0_minimal.1, 1.0_minimal.2, 1.0_minimal.3 and so on.
13
-
14
-## 3.3 Commit ID
15
-The ID listed is actually the first 5 bytes (10 hex digits) of the commit hash. If you want to see the entire 32 bytes hex number, just add the 'pretty' formatting option. The .0 at the end means that this is the default bootable deployment. This will change to 1 when another deployment will take its place as the default.
16
-```
17
-root@photon-host [ ~ ]# rpm-ostree status -p
18
-============================================================
19
-  * DEFAULT ON BOOT
20
-  version    1.0_minimal
21
-  timestamp  2016-06-07 14:06:17
22
-  id         56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4.0
23
-  osname     photon     
24
-  refspec    photon:photon/1.0/x86_64/minimal
25
-============================================================
26
-```
27
-## 3.4 OSname
28
-The OS Name identifies the operating system installed. All bootable filetrees for the same OS will share the /var directory, in other words applications installed in one booted image into this directory will be available in all other images.  
29
-If a new set of images are created for a different OS, they will receive a fresh copy of /var that is not shared with the previous OS images for the initial OS. In other words, if a machine is dual boot for different operating systems, they will not share each other's /var content, however they will still merge 3-way /etc.
30
-
31
-## 3.5 Refspec
32
-The **Refspec** is a branch inside the repo, expressed in a hierarchical way. In this case, it's the default branch that will receive package updates for the Photon OS 1.0 Minimal installation profile on Intel platforms. There could be other branches in the future, for example photon/1.0/x86_64/full that will match the Full installation profile (full set of packages installed).  
33
-Think of Refspec as the head of the minimal branch (just like in git) at the origin repo. On the replicated, local repo at the host, **minimal** is a file that contains the latest commit ID known for that branch.  
34
-```
35
-root@photon-host [ ~ ]# cat /ostree/repo/refs/remotes/photon/photon/1.0/x86_64/minimal 
36
-56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4
37
-```
38
-Why are there two 'photon' directory levels in the remotes path? The **photon:** prefix in the Refspec listed by `rpm-ostree status` corresponds to the first **photon** directory in the remotes path and is actually the name given to the remote that the host is connected to, which points to an http or https URL. We'll talk about remotes later, but for now think of it as a namespace qualifier.  The second **photon** is part of the Refspec path itself.
39
-
40
-## 3.6 Deployments
41
-We've used so far `rpm-ostree`. The same information can be obtained running an `ostree` command:
42
-```
43
-root@photon-host [ ~ ]# ostree admin status
44
-* photon 56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4.0
45
-    Version: 1.0_minimal
46
-    origin refspec: photon:photon/1.0/x86_64/minimal
47
-```
48
-But where is this information stored? As you may have guessed, the local repo stores the heads of the deployed trees - the most recent commitment ID, just like Git does:  
49
-```
50
-root@photon-host [ ~ ]# cat /ostree/repo/refs/heads/ostree/0/1/0 
51
-56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4
52
-```
53
-This also where this command that lists the references (local heads and remotes) takes its data from:
54
-```
55
-root@photon-host [ ~ ]# ostree refs
56
-photon:photon/1.0/x86_64/minimal
57
-ostree/0/1/0
58
-```
59
-Based on that, it could find the root of the deployment that it boots from. The actual filetree is deployed right here:
60
-```
61
-root@photon-host [ ~ ]# ls -l /ostree/deploy/photon/deploy/56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4.0
62
-total 36
63
-lrwxrwxrwx  1 root root    7 Jun  9 18:26 bin -> usr/bin
64
-drwxr-xr-x  4 root root 4096 Jan  1  1970 boot
65
-drwxr-xr-x  2 root root 4096 Jan  1  1970 dev
66
-drwxr-xr-x 33 root root 4096 Jun 12 23:04 etc
67
-lrwxrwxrwx  1 root root    8 Jun  9 18:26 home -> var/home
68
-lrwxrwxrwx  1 root root    7 Jun  9 18:26 lib -> usr/lib
69
-lrwxrwxrwx  1 root root    7 Jun  9 18:26 lib64 -> usr/lib
70
-lrwxrwxrwx  1 root root    9 Jun  9 18:26 media -> run/media
71
-lrwxrwxrwx  1 root root    7 Jun  9 18:26 mnt -> var/mnt
72
-lrwxrwxrwx  1 root root    7 Jun  9 18:26 opt -> var/opt
73
-lrwxrwxrwx  1 root root   14 Jun  9 18:26 ostree -> sysroot/ostree
74
-drwxr-xr-x  2 root root 4096 Jan  1  1970 proc
75
-lrwxrwxrwx  1 root root   12 Jun  9 18:26 root -> var/roothome
76
-drwxr-xr-x  2 root root 4096 Jan  1  1970 run
77
-lrwxrwxrwx  1 root root    8 Jun  9 18:26 sbin -> usr/sbin
78
-lrwxrwxrwx  1 root root    7 Jun  9 18:26 srv -> var/srv
79
-drwxr-xr-x  2 root root 4096 Jan  1  1970 sys
80
-drwxr-xr-x  2 root root 4096 Jan  1  1970 sysroot
81
-lrwxrwxrwx  1 root root   11 Jun  9 18:26 tmp -> sysroot/tmp
82
-drwxr-xr-x 10 root root 4096 Jan  1  1970 usr
83
-drwxr-xr-x  7 root root 4096 Jun  9 18:26 var
84
-```  
85
-So how is a deployment linked to a specific branch, originating from a remote repo? Well, there is a file next to the deployed filetree root directory with the same name and **.origin** suffix, that contains exactly this info:
86
-```
87
-root@photon-host [ ~ ]# cat /ostree/deploy/photon/deploy/56ef687f1319604b7900a232715718d26ca407de7e1dc89251b206f8e255dcb4.0.origin 
88
-[origin]
89
-refspec=photon:photon/1.0/x86_64/minimal
90
-```  
91
-Fast forwarding a bit, if there is a new deployment due to an upgrade or rebase, a new filetree will be added at the same level, and a new .origin file will tie it to the remote branch it originated from.  
92
-
93
-The **photon** directory in the path is the actual OSname. Multiple deployments of same OS will share a writable /var folder.  
94
-```
95
-root@photon-host [ ~ ]# ls -l /ostree/deploy/photon/var/
96
-total 52
97
-drwxr-xr-x  4 root root 4096 Jun  9 18:26 cache
98
-drwxr-xr-x  2 root root 4096 Jun  9 18:26 home
99
-drwxr-xr-x 13 root root 4096 Jun  9 18:26 lib
100
-drwxr-xr-x  2 root root 4096 Jun  9 18:26 local
101
-lrwxrwxrwx  1 root root   11 Jun  9 18:26 lock -> ../run/lock
102
-drwxr-xr-x  3 root root 4096 Jun  9 18:26 log
103
-drwxr-xr-x  2 root root 4096 Jun  9 18:26 mail
104
-drwxr-xr-x  2 root root 4096 Jun  9 18:26 mnt
105
-drwxr-xr-x  2 root root 4096 Jun  9 18:26 opt
106
-drwx------  2 root root 4096 Jun 12 23:06 roothome
107
-lrwxrwxrwx  1 root root    6 Jun  9 18:26 run -> ../run
108
-drwxr-xr-x  2 root root 4096 Jun  9 18:26 spool
109
-drwxr-xr-x  2 root root 4096 Jun  9 18:26 srv
110
-drwxrwxrwt  4 root root 4096 Jun 12 23:04 tmp
111
-drwxr-xr-x 11 root root 4096 Jun  9 18:26 usrlocal
112
-```
113
-
114
-
115 1
deleted file mode 100644
... ...
@@ -1,37 +0,0 @@
1
-# File Oriented Server Operations
2
-
3
-In this chapter, we will checkout a filetree into a writable directory structure on disk, make several file changes and commit the changes back into the repository. Then we will download this commit and apply at the host. As you may have guessed, this chapter is mostly about OSTree - the base technology. I've not mentioned anything about packages, although it is quite possible to install packages (afler all, packages are made of files, right?) and commit without the help of rpm-ostree, but it's too much of a headache and not worth the effort, since rpm-ostree does it simpler and better.  
4
-
5
-When would you want to do that? When you want for all your hosts to get an application or configuration customization that is not encapsulated as part of a package upgrade.
6
-
7
-## 8.1 Starting a fresh OSTree repo  
8
-If you want to start fresh with your own branch and/or versioning scheme, you can delete the OSTree repo created during the Photon 1.0 RPM-OSTree server install and re-create it empty. For Photon OS 2.0 RPM-OSTree, this is a required step, as the installer will not create an OSTree repo for you, as you can see in 12.1.  
9
-```
10
-root [ /srv/rpm-ostree ]# rm -rf repo
11
-
12
-root [ /srv/rpm-ostree ]# ostree --repo=repo init --mode=archive-z2
13
-
14
-root [ /srv/rpm-ostree ]# ls repo                                  
15
-config  objects  refs  state  tmp  uncompressed-objects-cache
16
-
17
-root [ /srv/rpm-ostree ]# cat repo/config
18
-[core]
19
-repo_version=1
20
-mode=archive-z2
21
-```
22
-
23
-## 8.2 Checking out a filetree
24
-[content to be added]
25
-
26
-## 8.3 Committing changes to a filetree
27
-[content to be added]
28
-
29
-## 8.4 Downloading the changes at the host
30
-[content to be added]
31
-
32
-## 8.5 Creating summary metadata
33
-A newer ostree feature, available in Photon OS 2.0 and higher, allows the OSTree server admin to create server summary metadata, that includes among other things the list of available branches and the list of static deltas, so they could be discovered by hosts. To create a summary, run this command after you committed for your branches:
34
-```
35
-root [ /srv/rpm-ostree ]# ostree summary -u "This is BigData's OSTree server, it has three branches"
36
-```  
37
-We will find out later how the [hosts query for branches list](Photon-RPM-OSTree-10-Remotes.md#105-list-available-branches). 
... ...
@@ -4,9 +4,9 @@ The Photon OS Documentation provides information about how to install, configure
4 4
 
5 5
  ![PhotonOS Logo](images/photonos-logo-lg.png)
6 6
 
7
-**Product version: 1.0 and 2.0**
7
+**Product version: 3.0**
8 8
 
9
-This documentation applies to all 1.0.x and 2.0.x releases.
9
+This documentation applies to all 3.0.x releases.
10 10
 
11 11
 ## Intended Audiences
12 12
 
... ...
@@ -1,112 +1,79 @@
1 1
 # Summary
2 2
 
3
-## Photon OS 1.0 and 2.0
3
+## Photon OS 3.0
4 4
 
5 5
 ----
6 6
 
7 7
 - [Introduction](README.md)
8
+- [Overview](Overview.md)
9
+    - [Introduction to Photon OS](Introduction.md) 
8 10
 - [Getting Started Guides](getting-started-guides.md)
9 11
     - [Downloading Photon OS](Downloading-Photon-OS.md)
10 12
     -  [Quick Start](photon-admin-guide.md#getting-started-with-photon-os-20)
11
-    -   [Upgrading to Photon OS 2.0](Upgrading-to-Photon-OS-2.0.md)
12
-    -   [What is New in Photon OS 2.0](What-is-New-in-Photon-OS-2.0.md)
13
-    -   [Running Photon OS on vSphere](Running-Photon-OS-on-vSphere.md)
14
-    -   [Running Photon OS on Fusion](Running-Project-Photon-on-Fusion.md)
15
-    -   [Running Photon OS on Workstation](Running-Photon-OS-on-Workstation.md)
16
-    -   [Running Photon OS on AWS EC2](Running-Photon-OS-on-Amazon-Elastic-Cloud-Compute.md)
17
-    -   [Running Photon OS on Microsoft Azure](Running-Photon-OS-on-Microsoft-Azure.md)
18
-    -   [Running Photon OS on Google Compute Engine](Running-Photon-OS-on-Google-Compute-Engine.md)
19
-        -  [Photon OS on GCE](gce.md)
20
-    - [Running Project Photon on vCloud Air](Running-Project-Photon-on-vCloud-Air.md)        
21
-- [Administration Guides](admin-guides.md)
22
-    - [Photon OS Administration Guide](photon-admin-guide.md)
23
-         - [Photon Management Daemon Command-line Interface (pmd-cli)](pmd-cli.md)
24
-         - [Network Configuration Manager - C API](netmgr.c.md)
25
-         - [Photon Network Manager Command-line Interface (netmgr)](netmgr-cli.md)
26
-         - [Network Configuration Manager - Python API](netmgr.python.md)
27
-         - [How to use Photon Management Daemon](pmd-cli.md)
28
-         - [Managing Packages in Photon OS with tdnf](tdnf.md)
29
-    - [Photon RPM OSTree](Photon-RPM-OSTree-a-simple-guide.md)
30
-        1. [Introduction](Photon-RPM-OSTree-1-Introduction.md)  
31
-            1. [What is OSTree? How about   RPM-OSTree?](Photon-RPM-OSTree-1-Introduction.md#11-what-is-ostree-how-about-rpm-ostree)
32
-            1. [Why use RPM-OSTree in Photon?](Photon-RPM-OSTree-1-Introduction.md#12-why-use-rpm-ostree-in-photon)
33
-            1. [Photon with RPM-OSTree installation profiles](Photon-RPM-OSTree-1-Introduction.md#13-photon-with-rpm-ostree-installation-profiles)
34
-            1. [Terminology](Photon-RPM-OSTree-1-Introduction.md#14-terminology)
35
-            1. [Sample code](Photon-RPM-OSTree-1-Introduction.md#15-sample-code)
36
-            1. [How to read this book](Photon-RPM-OSTree-1-Introduction.md#16-how-to-read-this-book)
37
-            1. [Difference between versions
38
-](Photon-RPM-OSTree-1-Introduction.md#17-difference-between-versions)
39
-        2. [Installing a Photon RPM-OSTree host against default server repository](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md)  
40
-            1. [Who is this for?](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md#21-who-is-this-for)
41
-            1. [Installing the ISO, step by step](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md#22-installing-the-iso-step-by-step)
42
-        3. [Concepts in action](Photon-RPM-OStree-3-Concepts-in-action.md)  
43
-            1. [Querying the deployed   filetrees](Photon-RPM-OStree-3-Concepts-in-action.md#31-querying-the-deployed-filetrees)
44
-            1. [Bootable filetree version](Photon-RPM-OStree-3-Concepts-in-action.md#32-bootable-filetree-version)
45
-            1. [Commit ID](Photon-RPM-OStree-3-Concepts-in-action.md#33-commit-id)
46
-            1. [OSname](Photon-RPM-OStree-3-Concepts-in-action.md#34-osname)
47
-            1. [Refspec](Photon-RPM-OStree-3-Concepts-in-action.md#35-refspec)
48
-            1. [Deployments](Photon-RPM-OStree-3-Concepts-in-action.md#36-deployments)
49
-        4. [Querying for commit, file and package metadata](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md)  
50
-            1. [Commit history](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#41-commit-history)
51
-            1. [Listing file mappings](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#42-listing-file-mappings)
52
-            1. [Listing configuration changes](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#43-listing-configuration-changes)
53
-            1. [Listing packages](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#44-listing-packages)
54
-            1. [Querying for package details](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#45-querying-for-package-details)
55
-            1. [Why am I unable to install, update or delete packages?](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#46-why-am-i-unable-to-install-update-or-delete-packages)
56
-        5. [Host updating operations](Photon-RPM-OSTree-5-Host-updating-operations.md)  
57
-            1. [Is it an update or an upgrade?](Photon-RPM-OSTree-5-Host-updating-operations.md#51-is-it-an-update-or-an-upgrade)
58
-            1. [Incremental upgrade](Photon-RPM-OSTree-5-Host-updating-operations.md#52-incremental-upgrade)
59
-            1. [Listing file differences](Photon-RPM-OSTree-5-Host-updating-operations.md#53-listing-file-differences)
60
-            1. [Listing package differences](Photon-RPM-OSTree-5-Host-updating-operations.md#54-listing-package-differences)
61
-            1. [Rollback](Photon-RPM-OSTree-5-Host-updating-operations.md#55-rollback)
62
-            1. [Deleting a deployed filetree](Photon-RPM-OSTree-5-Host-updating-operations.md#56-deleting-a-deployed-filetree)
63
-            1. [Version skipping upgrade](Photon-RPM-OSTree-5-Host-updating-operations.md#57-version-skipping-upgrade)
64
-            1. [Tracking parent commits](Photon-RPM-OSTree-5-Host-updating-operations.md#58-tracking-parent-commits)
65
-            1. [Resetting a branch to a previous commit](Photon-RPM-OSTree-5-Host-updating-operations.md#59-resetting-a-branch-to-a-previous-commit)
66
-        6. [Installing a Photon RPM-OSTree server](Photon-RPM-OSTree-6-Installing-a-server.md)  
67
-            1. [Manual install of a server](Photon-RPM-OSTree-6-Installing-a-server.md#61-manual-install-of-a-server)
68
-            1. [Composing your first OSTree repo](Photon-RPM-OSTree-6-Installing-a-server.md#62-composing-your-first-ostree-repo)
69
-            1. [Automated install of a server via kickstart](Photon-RPM-OSTree-6-Installing-a-server.md#63-automated-install-of-a-server-via-kickstart)
70
-        7. [Installing a Photon RPM-OStree host against a custom server repository](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md)  
71
-            1. [Manual install of a custom host](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md#71-manual-install-of-a-custom-host)
72
-            1. [Automated install of a custom host via kickstart](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md#72-automated-install-of-a-custom-host-via-kickstart)
73
-        8. [File oriented server operations](Photon-RPM-OStree-8-File-oriented-server-operations.md)
74
-            1. [Starting a fresh OSTree repo](Photon-RPM-OStree-8-File-oriented-server-operations.md#81-starting-a-fresh-ostree-repo)
75
-            1. [Checking out a filetree](Photon-RPM-OStree-8-File-oriented-server-operations.md#82-checking-out-a-filetree)
76
-            1. [Committing changes to a filetree](Photon-RPM-OStree-8-File-oriented-server-operations.md#83-committing-changes-to-a-filetree)
77
-            1. [Downloading the changes at the host](Photon-RPM-OStree-8-File-oriented-server-operations.md#84-downloading-the-changes-at-the-host)
78
-            1. [Creating summary metadata](Photon-RPM-OStree-8-File-oriented-server-operations.md#85-creating-summary-metadata)
79
-        9. [Package oriented server operations](Photon-RPM-OSTree-9-Package-oriented-server-operations.md)  
80
-            1. [JSON configuration file](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#91-json-configuration-file)
81
-            1. [Package addition, removal, upgrade](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#92-package-addition-removal-upgrade)
82
-            1. [RPMS repository](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#93-rpms-repository)
83
-            1. [Composing a tree](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#94-composing-a-tree)
84
-            1. [Automatic version prefix](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#95-automatic-version-prefix)
85
-            1. [Installing package updates](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#96-installing-package-updates)
86
-            1. [Composing for a different branch](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#97-composing-for-a-different-branch)
87
-        10. [Remotes](Photon-RPM-OSTree-10-Remotes.md)  
88
-            1. [Listing remotes](Photon-RPM-OSTree-10-Remotes.md#101-listing-remotes)
89
-            1. [GPG signature verification](Photon-RPM-OSTree-10-Remotes.md#102-gpg-signature-verification)
90
-            1. [Switching repositories](Photon-RPM-OSTree-10-Remotes.md#103-switching-repositories)
91
-            1. [Adding and removing remotes](Photon-RPM-OSTree-10-Remotes.md#104-adding-and-removing-remotes)
92
-            1. [List available branches](Photon-RPM-OSTree-10-Remotes.md#105-list-available-branches)
93
-        11. [Running container applications between bootable images](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md)  
94
-            1. [Downloading a docker container appliance](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md#111-downloading-a-docker-container-appliance)
95
-            1. [Rebooting into an existing image](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md#112-rebooting-into-an-existing-image)
96
-            1. [Reboot into a newly created image](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md#113-reboot-into-a-newly-created-image)
97
-        12. [Install or rebase to Photon OS 2.0](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md)  
98
-            1. [Installing an RPM-OSTree server](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#121-installing-an-rpm-ostree-server)
99
-            1. [Installing an RPM-OSTree host](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#122-installing-an-rpm-ostree-host)
100
-            1. [Rebasing a host from Photon 1.0 to 2.0](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#123-rebasing-a-host-from-photon-10-to-20)
101
-            1. [Creating a host raw image](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#124-creating-a-host-raw-image)
102
-    
103
-            [Appendix A: Known issues](Photon-RPM-OSTree-Appendix-A-Known-issues.md)  
13
+    -  [Running Photon OS on vSphere](Running-Photon-OS-on-vSphere.md)
14
+    -  [Running Photon OS on Fusion](Running-Project-Photon-on-Fusion.md)
15
+    -  [Running Photon OS on Workstation](Running-Photon-OS-on-Workstation.md)
16
+    -  [Running Photon OS on AWS EC2](Running-Photon-OS-on-Amazon-Elastic-Cloud-Compute.md)
17
+    -  [Running Photon OS on Microsoft Azure](Running-Photon-OS-on-Microsoft-Azure.md)
18
+    -  [Running Photon OS on Google Compute Engine](Running-Photon-OS-on-Google-Compute-Engine.md)
19
+        -  [Photon OS on GCE](gce.md)      
20
+- [Photon OS Administration Guide](photon_admin/README.md)
21
+    -  [Examining the Packages in the SPECS Directory on Github](photon_admin/examining_packages_spec_dir.md)
22
+    -  [Looking at the Differences Between the Minimal and the Full Version](photon_admin/differences_between_minimal_and_full_version.md)
23
+        -   [The Root Account and the `sudo` and `su` Commands](photon_admin/root_account_and_sudo_commands.md)
24
+    -   [Tiny DNF for Package Management](photon_admin/tiny-dnf-for-package-management.md)
25
+        -   [Configuration Files and Repositories](photon_admin/configuration-files-and-repositories.md)
26
+        -   [Options for Commands](photon_admin/options-for-commands.md)
27
+        -   [Commands](photon_admin/commands.md)
28
+        -   [Adding a New Repository](photon_admin/adding-a-new-repository.md)
29
+        -   [Adding the Dev Repository to Get New Packages from the GitHub Dev Branch](photon_admin/adding-the-dev-repository.md)
30
+    -   [Managing Services with systemd](photon_admin/managing-services-with-systemd.md)
31
+        -   [Using the Photon Management Daemon](photon_admin/using-the-photon-management-daemon.md)
32
+        -   [Viewing Services](photon_admin/viewing-services.md)
33
+        -   [Controlling Services](photon_admin/controlling-services.md)
34
+        -   [Creating a Startup Service](photon_admin/creating-a-startup-service.md)
35
+        -   [Disabling the Photon OS httpd.service](photon_admin/disabling-the-photon-os-httpd.service.md)
36
+        -   [Auditing System Events with auditd](photon_admin/auditing-system-events-with-auditd.md)
37
+        -   [Analyzing systemd Logs with journalctl](photon_admin/analyzing-systemd-logs-with-journalctl.md)
38
+        -   [Migrating Scripts to systemd](photon_admin/migrating-scripts-to-systemd.md)
39
+    -   [Managing the Network Configuration](photon_admin/managing-the-network-configuration.md)
40
+        -   [Using the Network Configuration Manager](photon_admin/using-the-network-configuration-manager.md)
41
+        -   [Use `ip` and `ss` Commands Instead of `ifconfig` and `netstat`](photon_admin/use-ip-and-ss-commands.md)
42
+        -   [Configuring Network Interfaces](photon_admin/configuring-network-interfaces.md)
43
+        -   [Setting a Static IP Address](photon_admin/setting-a-static-ip-address.md)
44
+        -   [Turning Off DHCP](photon_admin/turning-off-dhcp.md)
45
+        -   [Adding a DNS Server](photon_admin/adding-a-dns-server.md)
46
+        -   [Setting Up Networking for Multiple NICs](photon_admin/setting-up-networking-for-multiple-nics.md)
47
+        -   [Combining DHCP and Static IP Addresses with IPv4 and IPv6](photon_admin/combining-dhcp-and-static-ip-addresses-with-ipv4-and-ipv6.md)
48
+        -   [Clearing the Machine ID of a Cloned Instance for DHCP](photon_admin/clearing-the-machine-id-of-a-cloned-instance-for-dhcp.md)
49
+        -   [Using Predictable Network Interface Names](photon_admin/using-predictable-network-interface-names.md)
50
+        -   [Inspecting the Status of Network Links with `networkctl`](photon_admin/inspecting-the-status-of-network-links-with-networkctl.md)
51
+        -   [Turning on Network Debugging](photon_admin/turning-on-network-debugging.md)
52
+        -   [Mounting a Network File System](photon_admin/mounting-a-network-file-system.md)
53
+        -   [Installing the Packages for tcpdump and netcat with tdnf](photon_admin/installing-the-packages-for-tcpdump-and-netcat-with-tdnf.md)
54
+    -   [Cloud-Init on Photon OS](photon_admin/cloud-init-on-photon-os.md)
55
+        -   [Creating a Stand-Alone Photon Machine with cloud-init](photon_admin/creating-a-stand-alone-photon-machine-with-cloud-init.md)
56
+        -   [Customizing a Photon OS Machine on EC2](photon_admin/customizing-a-photon-os-machine-on-ec2.md)
57
+        -   [Running a Photon OS Machine on GCE](photon_admin/running-a-photon-os-machine-on-gce.md)
58
+    -   [Docker Containers](photon_admin/docker-containers.md)
59
+    -   [Kubernetes](photon_admin/kubernetes.md)
60
+    -   [Installing Sendmail](photon_admin/installing-sendmail.md
61
+    -   [Changing the Locale](photon_admin/changing-the-locale.md)
62
+    -   [The Default Security Policy of Photon OS](photon_admin/default-security-policy-of-photon-os.md)
63
+        -   [Default Firewall Settings](photon_admin/default-firewall-settings.md)
64
+        -   [Default Permissions and umask](photon_admin/default-permissions-and-umask.md)
65
+    -   [Disabling TLS 1.0 to Improve Transport Layer Security](photon_admin/disabling-tls.md)
66
+    -   [Working with Repositories and Packages](photon_admin/working-with-repositories-and-packages.md)
67
+        -   [Photon OS Package Repositories](photon_admin/photon-os-package-repositories.md)
68
+        -   [Examining Signed Packages](photon_admin/signed-packages.md)
69
+        -   [Building a Package from a Source RPM](photon_admin/building-a-package-from-a-source-rpm.md)
70
+        -   [Compiling C++ Code on the Minimal Version of Photon OS](photon_admin/compiling-c-code-on-the-minimal-version-of-photon-os.md)
71
+    - [Photon Management Daemon Command-line Interface (pmd-cli)](photon_admin/pmd-cli.md)
72
+    - [Network Configuration Manager - C API](photon_admin/netmgr.c.md)
73
+    - [Photon Network Manager Command-line Interface (netmgr)](photon_admin/netmgr-cli.md)
74
+    - [Network Configuration Manager - Python API](photon_admin/netmgr.python.md)
75
+    - [Managing Packages in Photon OS with tdnf](photon_admin/tdnf.md)
104 76
 - [How-To Guides](how-to-guides.md)
105
-    - [Setting Up a Swarm Cluster with DNS](Install-and-Configure-a-Swarm-Cluster-with-DNS-Service-on-PhotonOS.md)
106
-    - [Setting Up a Mesos Cluster](Install-and-Configure-a-Production-Ready-Mesos-Cluster-on-Photon-OS.md)
107
-    - [Setting Up Marathon for a Mesos Cluster](Install-and-Configure-Marathon-for-Mesos-Cluster-on-PhotonOS.md)
108
-    - [Setting Up DCOS CLI for Mesos](Install-and-Configure-DCOS-CLI-for-Mesos.md)
109
-    - [Setting Up Mesos DNS on a Mesos Cluster](Install-and-Configure-Mesos-DNS-on-a-Mesos-Cluster.md)
110 77
     - [Setting Up a Network PXE Boot Server](PXE-boot.md)
111 78
     - [Working with Kickstart](kickstart.md)
112 79
     - [Running Kubernetes](kubernetes.md)
113 80
deleted file mode 100644
... ...
@@ -1,25 +0,0 @@
1
-# Upgrading to Photon OS 2.0
2
-
3
-You can upgrade your existing Photon OS 1.0 VMs to take advantage of security and functionality enhancements in Photon OS 2.0. For details, see [What is New in Photon OS 2.0](What-is-New-in-Photon-OS-2.0.md).
4
-
5
-Photon OS 2.0 provides a seamless, in-place upgrade path for Photon OS 1.0 implementations. You simply download an upgrade package, run a script, and reboot the VM. The upgrade script will update your packages and retain your 1.0 customizations in your new OS 2.0 VM.
6
-
7
-**Note:** If your 1.0 VM is a full install, then you will have a 2.0 VM that represents a full install (all packages and dependencies). Upgrading a minimal installation takes less time due to fewer packages.
8
-
9
-For each Photon OS 1.0 VM that you want to upgrade, complete the following steps:
10
-
11
-1. Back up all existing settings and data for the Photon OS 1.0 VM.
12
-
13
-2. Stop any services (for example, docker) that are currently running in the VM.
14
-
15
-3. Download the upgrade package. From the Photon OS 1.0 command line, run the following command:
16
-~~~~
17
-    # tdnf install photon-upgrade
18
-~~~~    
19
-4. Run the upgrade script (photon-upgrade.sh), which upgrades packages and dependencies. Answer Y to any questions.
20
-~~~~
21
-    # photon-upgrade.sh
22
-~~~~
23
-5. Answer Y to reboot the VM. The upgrade script powers down the Photon OS 1.0 VM and powers it on as a Photon OS 2.0 VM.
24
-
25
-After upgrading but before you deploy into production, test all previous functionality to ensure that everything works as expected.
26 1
\ No newline at end of file
27 2
deleted file mode 100644
... ...
@@ -1,24 +0,0 @@
1
-Photon OS 2.0 introduces new security and OS management capabilities, along with new and updated packages for Cloud native applications and VMware appliances. This topic summarizes what&#39;s new and different in Photon OS 2.0.
2
-
3
-## Security Enhancements
4
-
5
-- Security-hardened Linux kernel: In addition to the linux and linux-esx kernels, Photon OS 2.0 provides a new security-hardened kernel (linux-secure), which is configured according to the recommendations of the Kernel Self-Protection Project (KSPP), plus includes most of the Pax patches.
6
-- Secure EFI boot: The operating system now boots with validated trust.
7
-- Python 3 (Python 2 is deprecated)
8
-
9
-## OS and Storage Management Enhancements
10
-
11
-- The Network Configuration Manager provides a library of C, Python, and CLI APIs that simplify common configuration tasks for network resources, including network interfaces, IP addresses, routes, DNS servers and domains, DHCP DUID and IAID, NTP servers, and other service management operations.
12
-- The Photon Management Daemon (PMD) provides the remote management of a Photon instance via a command line client (pmd-cli), Python, and REST API interfaces. The PMD provides the ability to manage network interfaces,  packages, firewalls, users, and user groups.
13
-- Project Lightwave integration: The open source security platform from VMware authenticates and authorizes users and groups with AD or LDAP.
14
-- Support for persistent volumes to store the data of cloud-native apps on VMware vSAN
15
-- Update notification
16
-- Guestinfo for cloud-init
17
-
18
-## Package and Binary Maintenance
19
-
20
-- Cloud-ready images for rapid deployment on Microsoft Azure (new), Google Compute Engine (GCE), Amazon Elastic Compute Cloud (EC2), and VMware products (vSphere, Fusion, and Workstation)
21
-- New Linux OSS packages
22
-- New packages, including Calico, Heapster, nginx-ingress, RabbitMQ, and the proxy for Wavefront by VMware
23
-- Updates to key packages, including the LTS version of the Linux kernel (4.9) and systemd
24
-- Support for multiple Java versions
25 1
deleted file mode 100644
... ...
@@ -1,82 +0,0 @@
1
-# Photon OS Administration Guides
2
-
3
-- [Photon OS Administration Guide](photon-admin-guide.md)
4
-    - [Photon Management Daemon Command-line Interface (pmd-cli)](pmd-cli.md)
5
-    - [Network Configuration Manager - C API](netmgr.c.md)
6
-    - [Photon Network Manager Command-line Interface (netmgr)](netmgr-cli.md)
7
-    - [Network Configuration Manager - Python API](netmgr.python.md)
8
-    - [How to use Photon Management Daemon](pmd-cli.md)
9
-    - [Managing Packages in Photon OS with tdnf](tdnf.md)
10
-- [Photon RPM OSTree](Photon-RPM-OSTree-a-simple-guide.md)
11
-    1. [Introduction](Photon-RPM-OSTree-1-Introduction.md)
12
-        1. [What is OSTree? How about   RPM-OSTree?](Photon-RPM-OSTree-1-Introduction.md#11-what-is-ostree-how-about-rpm-ostree)
13
-        1. [Why use RPM-OSTree in Photon?](Photon-RPM-OSTree-1-Introduction.md#12-why-use-rpm-ostree-in-photon)
14
-        1. [Photon with RPM-OSTree installation profiles](Photon-RPM-OSTree-1-Introduction.md#13-photon-with-rpm-ostree-installation-profiles)
15
-        1. [Terminology](Photon-RPM-OSTree-1-Introduction.md#14-terminology)
16
-        1. [Sample code](Photon-RPM-OSTree-1-Introduction.md#15-sample-code)
17
-        1. [How to read this book](Photon-RPM-OSTree:-1-Introduction#16-how-to-read-this-book)
18
-        1. [RPM-OSTree in Photon OS 2.0](Photon-RPM-OSTree:-1-Introduction#17-rpm-ostree-in-photon-os-20)
19
-    2. [Installing a Photon RPM-OSTree host against default server repository](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md)  
20
-        1. [Who is this for?](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md#21-who-is-this-for)
21
-        1. [Installing the ISO, step by step](Photon-RPM-OSTree-2-Installing-a-host-against-default-server-repository.md#22-installing-the-iso-step-by-step)
22
-    3. [Concepts in action](Photon-RPM-OStree-3-Concepts-in-action.md)  
23
-        1. [Querying the deployed   filetrees](Photon-RPM-OStree-3-Concepts-in-action.md#31-querying-the-deployed-filetrees)
24
-        1. [Bootable filetree version](Photon-RPM-OStree-3-Concepts-in-action.md#32-bootable-filetree-version)
25
-        1. [Commit ID](Photon-RPM-OStree-3-Concepts-in-action.md#33-commit-id)
26
-        1. [OSname](Photon-RPM-OStree-3-Concepts-in-action.md#34-osname)
27
-        1. [Refspec](Photon-RPM-OStree-3-Concepts-in-action.md#35-refspec)
28
-        1. [Deployments](Photon-RPM-OStree-3-Concepts-in-action.md#36-deployments)
29
-    4. [Querying for commit, file and package metadata](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md)  
30
-        1. [Commit history](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#41-commit-history)
31
-        1. [Listing file mappings](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#42-listing-file-mappings)
32
-        1. [Listing configuration changes](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#43-listing-configuration-changes)
33
-        1. [Listing packages](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#44-listing-packages)
34
-        1. [Querying for package details](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#45-querying-for-package-details)
35
-        1. [Why am I unable to install, update or delete packages?](Photon-RPM-OSTree-4-Querying-for-commit-file-and-package-metadata.md#46-why-am-i-unable-to-install-update-or-delete-packages)
36
-    5. [Host updating operations](Photon-RPM-OSTree-5-Host-updating-operations.md)  
37
-        1. [Is it an update or an upgrade?](Photon-RPM-OSTree-5-Host-updating-operations.md#51-is-it-an-update-or-an-upgrade)
38
-        1. [Incremental upgrade](Photon-RPM-OSTree-5-Host-updating-operations.md#52-incremental-upgrade)
39
-        1. [Listing file differences](Photon-RPM-OSTree-5-Host-updating-operations.md#53-listing-file-differences)
40
-        1. [Listing package differences](Photon-RPM-OSTree-5-Host-updating-operations.md#54-listing-package-differences)
41
-        1. [Rollback](Photon-RPM-OSTree-5-Host-updating-operations.md#55-rollback)
42
-        1. [Deleting a deployed filetree](Photon-RPM-OSTree-5-Host-updating-operations.md#56-deleting-a-deployed-filetree)
43
-        1. [Version skipping upgrade](Photon-RPM-OSTree-5-Host-updating-operations.md#57-version-skipping-upgrade)
44
-        1. [Tracking parent commits](Photon-RPM-OSTree-5-Host-updating-operations.md#58-tracking-parent-commits)
45
-        1. [Resetting a branch to a previous commit](Photon-RPM-OSTree-5-Host-updating-operations.md#59-resetting-a-branch-to-a-previous-commit)
46
-    6. [Installing a Photon RPM-OSTree server](Photon-RPM-OSTree-6-Installing-a-server.md)  
47
-        1. [Manual install of a server](Photon-RPM-OSTree-6-Installing-a-server.md#61-manual-install-of-a-server)
48
-        1. [Composing your first OSTree repo](Photon-RPM-OSTree-6-Installing-a-server.md#62-composing-your-first-ostree-repo)
49
-        1. [Automated install of a server via kickstart](Photon-RPM-OSTree-6-Installing-a-server.md#63-automated-install-of-a-server-via-kickstart)
50
-    7. [Installing a Photon RPM-OStree host against a custom server repository](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md)  
51
-         1. [Manual install of a custom host](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md#71-manual-install-of-a-custom-host)
52
-         1. [Automated install of a custom host via kickstart](Photon-RPM-OSTree-7-Installing-a-host-against-a-custom-server-repository.md#72-automated-install-of-a-custom-host-via-kickstart)
53
-    8. [File oriented server operations](Photon-RPM-OStree-8-File-oriented-server-operations.md)
54
-         1. [Starting a fresh OSTree repo](Photon-RPM-OStree-8-File-oriented-server-operations.md#81-starting-a-fresh-ostree-repo)
55
-         1. [Checking out a filetree](Photon-RPM-OStree-8-File-oriented-server-operations.md#82-checking-out-a-filetree)
56
-         1. [Committing changes to a filetree](Photon-RPM-OStree-8-File-oriented-server-operations.md#83-committing-changes-to-a-filetree)
57
-         1. [Downloading the changes at the host](Photon-RPM-OStree-8-File-oriented-server-operations.md#84-downloading-the-changes-at-the-host)
58
-         1. [Creating summary metadata](Photon-RPM-OStree-8-File-oriented-server-operations.md#85-creating-summary-metadata)
59
-    9. [Package oriented server operations](Photon-RPM-OSTree-9-Package-oriented-server-operations.md)  
60
-         1. [JSON configuration file](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#91-json-configuration-file)
61
-         1. [Package addition, removal, upgrade](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#92-package-addition-removal-upgrade)
62
-         1. [RPMS repository](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#93-rpms-repository)
63
-         1. [Composing a tree](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#94-composing-a-tree)
64
-         1. [Automatic version prefix](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#95-automatic-version-prefix)
65
-         1. [Installing package updates](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#96-installing-package-updates)
66
-         1. [Composing for a different branch](Photon-RPM-OSTree-9-Package-oriented-server-operations.md#97-composing-for-a-different-branch)
67
-    9. [Remotes](Photon-RPM-OSTree-10-Remotes.md)  
68
-         1. [Listing remotes](Photon-RPM-OSTree-10-Remotes.md#101-listing-remotes)
69
-         1. [GPG signature verification](Photon-RPM-OSTree-10-Remotes.md#102-gpg-signature-verification)
70
-         1. [Switching repositories](Photon-RPM-OSTree-10-Remotes.md#103-switching-repositories)
71
-         1. [Adding and removing remotes](Photon-RPM-OSTree-10-Remotes.md#104-adding-and-removing-remotes)
72
-         1. [List available branches](Photon-RPM-OSTree-10-Remotes.md#105-list-available-branches)
73
-    9. [Running container applications between bootable images](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md)  
74
-         1. [Downloading a docker container appliance](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md#111-downloading-a-docker-container-appliance)
75
-         1. [Rebooting into an existing image](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md#112-rebooting-into-an-existing-image)
76
-         1. [Reboot into a newly created image](Photon-RPM-OSTree-11-Running-container-applications-between-bootable-images.md#113-reboot-into-a-newly-created-image)
77
-    9. [Install or rebase to Photon OS 2.0](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md)  
78
-         1. [Installing an RPM-OSTree server](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#121-installing-an-rpm-ostree-server)
79
-         1. [Installing an RPM-OSTree host](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#122-installing-an-rpm-ostree-host)
80
-         1. [Rebasing a host from Photon 1.0 to 2.0](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#123-rebasing-a-host-from-photon-10-to-20)
81
-         1. [Creating a host raw image](Photon-RPM-OSTree-Install-or-rebase-to-Photon-OS-2.0.md#124-creating-a-host-raw-image)
82
-    9. [Appendix A: Known issues](Photon-RPM-OSTree-Appendix-A-Known-issues.md) 
... ...
@@ -1,6 +1,6 @@
1 1
 {
2 2
 
3
-	"title": "VMware Photon OS 1.0 and 2.0 Documentation",
3
+	"title": "VMware Photon OS 3.0 Documentation",
4 4
         "gitbook": "3.x.x",
5 5
         "plugins": ["insert-logo", "chapter-fold", "edit-link", "noembed"],
6 6
         "pluginsConfig": {
7 7
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+# Introduction to Photon OS
1
+
2
+Photon OS, is an open-source minimalist Linux operating system from VMware that is optimized for cloud computing platforms, VMware vSphere deployments, and applications native to the cloud. 
3
+
4
+Photon OS is a Linux container host optimized for vSphere and cloud-computing platforms such as Amazon Elastic Compute and Google Compute Engine. As a lightweight and extensible operating system, Photon OS works with the most common container formats, including Docker, Rocket, and Garden. Photon OS includes a yum-compatible, package-based lifecycle management system called tdnf.
5
+
6
+When used with development tools and environments such as VMware Fusion, VMware Workstation, and production runtime environments (vSphere, vCloud Air), Photon OS lets you seamlessly migrate container-based applications from development to production. With a small footprint and fast boot and run times, Photon OS is optimized for cloud computing and cloud  applications.  
7
+
8
+Photon OS consists of a minimal version and a full version. 
9
+
10
+The minimal version of Photon OS is lightweight container host runtime environment that is suited to managing and hosting containers. The minimal version contains just enough packaging and functionality to manage and modify containers while remaining a fast runtime environment. The minimal version is ready to work with appliances. 
11
+
12
+The full version of Photon OS includes additional packages to help you customize the system and create containerized applications. For running containers, the full version is excessive. The full version is helps you create, develop, test, and package an application that runs a container. 
13
+
14
+The two distinguishing features of Photon OS are as follows:
15
+
16
+- It manages services with systemd. 
17
+    
18
+    By using systemd, Photon OS adopts a contemporary Linux standard to manage system services. Photon OS bootstraps the user space and concurrently starts services with systemd. The systemctl utility controls services on Photon OS. For example, instead of running the /etc/init.d/ssh script to stop and start the OpenSSH server on a init.d-based Linux system, you run the following systemctl commands on Photon OS: 
19
+    
20
+    - systemctl stop sshd
21
+    - systemctl start sshd
22
+
23
+- It manages packages with an open source, yum-compatible package manager called tdnf for Tiny DNF.
24
+    
25
+    Tdnf keeps the operating system as small as possible while preserving yum's robust package-management capabilities. On Photon OS, tdnf is the default package manager for installing new packages. It is a C implementation of the DNF package manager. 
0 26
deleted file mode 100644
... ...
@@ -1,239 +0,0 @@
1
-# Photon Network Manager Command-line Interface (netmgr)
2
-
3
-For locally logged-on users, Photon OS provides a command line interface to manage network configuration of the system.
4
-
5
-- [Setup Steps](#setup-steps)
6
-- [Syntax](#syntax)
7
-- [Network Manager CLI](#network-manager-cli)
8
-
9
-# Setup Steps
10
-
11
-The netmgr tool is included with your Photon OS distribution. To make sure that you have the latest version, you can run:
12
-~~~~
13
-tdnf install netmgmt
14
-~~~~
15
-# Syntax
16
-The CLI is built on set, get, add, delete command model and uses the option-name - option-value model of specifying command parameters.
17
-~~~~
18
-netmgr <network object> <--get | --set | --add | --del> <command options>
19
-~~~~
20
-Passed-in parameter values can be enclosed in single (&#39;) or double-quotes (&quot;) as long as you use matching characters to denote the beginning and end of the value. Unless a parameter value contains special characters or spaces, you can also omit quotes altogether.
21
-
22
-## network object
23
-
24
-``<network object>`` is one of the following values:
25
-
26
-- ``link_info``
27
-- ``ip4_address``
28
-- ``ip6_address``
29
-- ``ip_route``
30
-- ``dns_servers``
31
-- ``dns_domains``
32
-- ``dhcp_duid``
33
-- ``if_iaid``
34
-- ``ntp_servers``
35
-- ``hostname``
36
-- ``wait_for_link``
37
-- ``wait_for_ip``
38
-- ``error_info``
39
-- ``net_info``
40
-
41
-# Network Manager CLI
42
-
43
-## link_info
44
-
45
-Get the mac address, MTU, link state, and link mode for the (optionally) specified interface.
46
-~~~~
47
-netmgr link_info --get --interface <ifname>
48
-~~~~
49
-Set the MAC address, link state (up or down), link mode (manual or auto), or MTU for the specified interface.
50
-~~~~
51
-netmgr link_info --set --interface <ifname> --macaddr <mac_address>
52
-netmgr link_info --set --interface <ifname> --mode <manual|auto>
53
-netmgr link_info --set --interface <ifname> --state <up|down>
54
-netmgr link_info --set --interface <ifname> --mtu <mtu>
55
-~~~~
56
-## ip4_address
57
-
58
-Get the IPv4 address for the specified interface.
59
-~~~~
60
-netmgr ip4_address --get --interface <ifname>
61
-~~~~
62
-Set the IPv4 address (dot-decimal/prefix notation), mode (dhcp, static, or none), and (optionally) the default gateway for the specified interface.
63
-~~~~
64
-netmgr ip4_address --set --interface <ifname> --mode <dhcp|static|none> --addr <ipv4_address/prefix> --gateway <gateway_address>
65
-~~~~
66
-## ip6_address
67
-
68
-Get IPv6 addresses for the specified interface.
69
-~~~~
70
-netmgr ip6_address --get --interface <ifname>
71
-~~~~
72
-Add one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) to the specified interface.
73
-~~~~
74
-netmgr ip6_address --add --interface <ifname> --addrlist <ipv6_addr1/prefix,ipv6_addr2/prefix,...>
75
-~~~~
76
-Delete one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) from the specified interface.
77
-~~~~
78
-netmgr ip6_address --del --interface <ifname> --addrlist <ipv6_addr1/prefix,ipv6_addr2/prefix,...>
79
-~~~~
80
-Set the IPv6 DHCP mode (1=enable, 0=disable) and IPv6 auto-configuration settings (1=enable, 0=disable) for the specified interface.
81
-~~~~
82
-netmgr ip6_address --set --interface <ifname> --dhcp <1|0> --autoconf <1|0>
83
-~~~~
84
-## ip_route
85
-
86
-Get the static IP route for the specified interface.
87
-~~~~
88
-netmgr ip_route --get --interface <ifname>
89
-~~~~
90
-Add the static IP route (gateway IP, destination network, and metric) to the specified interface.
91
-~~~~
92
-netmgr ip_route --add --interface <ifname> --gateway <gateway_address> --destination <destination_network/prefix> --metric <N>
93
-~~~~
94
-Delete the specified static IP route from the specified interface.
95
-~~~~
96
-netmgr ip_route --del --interface <ifname> --destination <destination_network/prefix>
97
-~~~~
98
-## dns_servers
99
-
100
-Get the list of DNS servers.
101
-~~~~
102
-netmgr dns_servers --get
103
-~~~~
104
-Set the DNS mode (DHCP or static) for one or more DNS servers (comma-separated list).
105
-~~~~
106
-netmgr dns_servers --set --mode <dhcp|static> --servers <server1,server2,...>
107
-~~~~
108
-Add a DNS server to the list of DNS servers.
109
-~~~~
110
-netmgr dns_servers --add --servers <server>
111
-~~~~
112
-Remove the specified DNS server from the list of DNS servers.
113
-~~~~
114
-netmgr dns_servers --del --servers <server>
115
-~~~~
116
-## dns_domains
117
-
118
-Get the list of DNS domains.
119
-~~~~
120
-netmgr dns_domains --get
121
-~~~~
122
-Set the list of DNS domains (one or more DNS domains in a comma-separated list).
123
-~~~~
124
-netmgr dns_domains --set --domains <domain1,domain2,...>
125
-~~~~
126
-Add a DNS domain to the list of DNS domains.
127
-~~~~
128
-netmgr dns_domains --add --domains <domain>
129
-~~~~
130
-Delete a DNS domain from the list of DNS domains.
131
-~~~~
132
-netmgr dns_domains --del --domains <domain>
133
-~~~~
134
-## dhcp_duid
135
-
136
-Get the DHCP DUID (optionally interface-specific DUID) for the system.
137
-~~~~
138
-netmgr dhcp_duid --get
139
-~~~~
140
-Set the DHCP DUID for the system, optionally per-interface if the interface is specified.
141
-~~~~
142
-netmgr dhcp_duid --set --duid <duid>
143
-~~~~
144
-## if_iaid
145
-
146
-Get the IAID for the specified interface.
147
-~~~~
148
-netmgr if_iaid --get --interface <ifname>
149
-~~~~
150
-Set the IAID for the specified interface.
151
-~~~~
152
-netmgr if_iaid --set --interface <ifname> --iaid <iaid>
153
-~~~~
154
-## ntp_servers
155
-
156
-Get the NTP servers list.
157
-~~~~
158
-netmgr ntp_servers --get
159
-~~~~
160
-Set the NTP servers list.
161
-~~~~
162
-netmgr ntp_servers --set --servers <server1,server2,...>
163
-~~~~
164
-Add the specified server to the NTP servers list.
165
-~~~~
166
-netmgr ntp_servers --add --servers <server>
167
-~~~~
168
-Delete the specified server from the NTP servers list.
169
-~~~~
170
-netmgr ntp_servers --del --servers <server>
171
-~~~~
172
-## hostname
173
-
174
-Get the system hostname.
175
-~~~~
176
-netmgr hostname --get
177
-~~~~
178
-Set the system hostname.
179
-~~~~
180
-netmgr hostname --set --name <hostname>
181
-~~~~
182
-## wait_for_link
183
-
184
-Wait for the specified network interface to be up and usable (it can send and receive packets).
185
-~~~~
186
-netmgr wait_for_link --interface <ifname> --timeout <timeout>
187
-~~~~
188
-The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
189
-
190
-**Note:** You might need to use wait_for_ip to wait until you can send and receive IP packets.
191
-
192
-## wait_for_ip
193
-
194
-Wait for the specified interface to acquire a valid IP address for the specified address type.
195
-~~~~
196
-netmgr wait_for_ip --interface <ifname> --timeout <timeout> --addrtype <ipv4,ipv6,static_ipv4,static_ipv6,dhcp_ipv4,dhcp_ipv6,auto_ipv6,link_local_ipv6>
197
-~~~~
198
-The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
199
-
200
-## error_info
201
-
202
-Get error information about the specified error code.
203
-~~~~
204
-netmgr error_info --errcode <error_code>
205
-~~~~
206
-Here is a list of error codes:
207
-
208
-- 4097 - invalid parameter
209
-- 4098 - not supported
210
-- 4099 - out of memory
211
-- 4100 - value not found
212
-- 4101 - value exists
213
-- 4102 - invalid interface
214
-- 4103 - invalid mode
215
-- 4104 - bad configuration file
216
-- 4105 - write failed
217
-- 4106 - timeout
218
-- 4107 - DCHP timeout
219
-
220
-## net_info
221
-
222
-Get the specified network configuration parameter for the specified object.
223
-~~~~
224
-netmgr net_info --get --object <ifname or filename> --paramname <param_name>
225
-~~~~
226
-**Note:** The object can be an interface name (for example, &quot;eth0&quot;) or a file name (for example, /etc/systemd/resolved.conf).
227
-
228
-Set the value of the specified network configuration parameter for the specified object (interface or file).
229
-~~~~
230
-netmgr net_info --set --object <ifname or filename> --paramname <param_name> --paramvalue <param_value>
231
-~~~~
232
-**Note** : You can add (+) or remove (-) a parameter by prepending the parameter name with + or -.
233
-
234
-For example, in order to add static IPv4 address "10.10.10.1/24" to eth0 interface, the following command adds this **Address** to the **Network** section of the **eth0** network configuration file.
235
-~~~~
236
-netmgr net_info --set --object eth0 --paramname +Network_Address --paramvalue "10.10.10.1/24"
237
-~~~~
238
-
239
-
240 1
deleted file mode 100644
... ...
@@ -1,1587 +0,0 @@
1
-# Network Configuration Manager - C API
2
-
3
-Photon OS 2.0 provides a C API for the Network Configuration Manager.
4
-
5
-- [About the Network Configuration Manager C API](#about-the-network-configuration-manager-c-api)
6
-- [Interface Configuration APIs](#interface-configuration-apis)
7
-- [IP Address Configuration APIs](#ip-address-configuration-apis)
8
-- [Route Configuration APIs](#route-configuration-apis)
9
-- [DNS Configuration APIs](#dns-configuration-apis)
10
-- [DHCP Options DUID and IAID Configuration APIs](#dhcp-options-duid-and-iaid-configuration-apis)
11
-- [NTP Configuration APIs](#ntp-configuration-apis)
12
-- [Service Management APIs](#service-management-apis)
13
-
14
-# About the Network Configuration Manager C API
15
-
16
-Use the Network Configuration Manager C API to simplify common network configuration tasks for:
17
-
18
-- interfaces
19
-- IP addresses (IPv4 and IPv6 addresses)
20
-- routes
21
-- DNS server and domain settings
22
-- DHCP DUID and IAID settings
23
-- NTP server settings
24
-- service management
25
-- object parameters (interfaces and files)
26
-
27
-## Header File
28
-
29
-Header files for all the C APIs are defined in the following location:
30
-
31
-[https://github.com/](https://github.com/vmware/pmd/tree/master/include) [vmware](https://github.com/vmware/pmd/tree/master/include) [/pmd/tree/master/include](https://github.com/vmware/pmd/tree/master/include)
32
-
33
-To install the Network Configuration Manager header file, run the following command:
34
-
35
-``tdnf install netmgmt-devel``
36
-n
37
-Once installed, you can reference the header file in the following location:
38
-
39
-``/usr/include/netmgmt/netmgr.h``
40
-
41
-## Freeing Memory
42
-
43
-For all get APIs that take a pointer-to-pointer parameter, the caller has the responsibility to free the memory upon successful response from API by calling free().
44
-
45
-## Error Codes
46
-
47
-All C API calls return 0 for success, or one of the following error codes for failure.
48
-
49
-- 4097 - NM_ERR_INVALID_PARAMETER
50
-- 4098 - NM_ERR_NOT_SUPPORTED
51
-- 4099 - NM_ERR_OUT_OF_MEMORY
52
-- 4100 - NM_ERR_VALUE_NOT_FOUND
53
-- 4101 - NM_ERR_VALUE_EXISTS
54
-- 4102 - NM_ERR_INVALID_INTERFACE
55
-- 4103 - NM_ERR_INVALID_ADDRESS
56
-- 4104 - NM_ERR_INVALID_MODE
57
-- 4105 - NM_ERR_BAD_CONFIG_FILE
58
-- 4106 - NM_ERR_WRITE_FAILED
59
-- 4107 - NM_ERR_TIME_OUT
60
-- 4108 - NM_ERR_DHCP_TIME_OUT
61
-
62
-Use nm_get_error_info to retrieve information about an error code.
63
-~~~~
64
- const char \*
65
- nm_get_error_info(
66
-     uint32_t nmErrCode
67
- );``
68
-~~~~
69
-# Interface Configuration APIs
70
-
71
-The Photon OS 2.0 network manager C API enables you to manage network interfaces.
72
-
73
-## Structure Declarations
74
-
75
-### Link Mode
76
-
77
-**Description**
78
-
79
-Link mode. Available settings:
80
-
81
-- ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
82
-- ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
83
-- ``LINK_MODE_UNKNOWN`` - the link mode is unknown
84
-
85
-**Declaration**
86
-~~~~
87
- typedef enum _NET_LINK_MODE
88
- {
89
-     LINK_AUTO = 0,
90
-     LINK_MANUAL,
91
-     LINK_MODE_UNKNOWN
92
- } NET_LINK_MODE;``
93
-~~~~
94
-### Link State
95
-
96
-**Description**
97
-
98
-Link state. Available settings:
99
-
100
-- ``LINK_DOWN`` - the link is being administratively down or has no carrier signal
101
-- ``LINK_UP`` - the link is configured up and has carrier signal
102
-- ``LINK_STATE_UNKNOWN`` - link state is unknown
103
-
104
-**Declaration**
105
-~~~~
106
- typedef enum _NET_LINK_STATE
107
- {
108
-     LINK_DOWN = 0,
109
-     LINK_UP,
110
-     LINK_STATE_UNKNOWN,
111
- } NET_LINK_STATE;
112
-~~~~
113
-### Link Information
114
-
115
-**Description**
116
-
117
-Link information. Includes the following information:
118
-
119
-- ``pszInterfaceName`` - interface name
120
-- ``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
121
-- ``mtu`` - maximum transmission unit (MTU)
122
-- ``mode`` - link mode (see above)
123
-- ``state`` - link state (see above)
124
-
125
-**Declaration**
126
-~~~~
127
- typedef struct _NET_LINK_INFO
128
- {
129
-     struct _NET_LINK_INFO \*pNext;
130
-     char \*pszInterfaceName;
131
-     char \*pszMacAddress;
132
-     uint32_t mtu;
133
-     NET_LINK_MODE mode;
134
-     NET_LINK_STATE state;
135
- } NET_LINK_INFO, \*PNET_LINK_INFO;
136
-~~~~
137
-## nm_set_link_mac_addr
138
-
139
-**Description**
140
-
141
-Set the MAC address of the interface.
142
-
143
-**Declaration**
144
-~~~~
145
-uint32_t
146
-
147
-nm_set_link_mac_addr(
148
-
149
-     const char \*pszInterfaceName,
150
-     const char \*pszMacAddress
151
- );
152
-~~~~
153
-**Arguments**
154
-
155
-- ``pszInterfaceName`` - interface name
156
-- ``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
157
-
158
-**Returns**
159
-
160
-- success: 0
161
-- failure: error code
162
-
163
-## nm_get_link_mac_addr
164
-
165
-**Description**
166
-
167
-Get the MAC address of the interface.
168
-
169
-**Declaration**
170
-~~~~
171
-uint32_t
172
- nm_get_link_mac_addr(
173
-     const char \*pszInterfaceName,
174
-     char \*\*ppszMacAddress
175
- );
176
-~~~~
177
-**Arguments**
178
-
179
-- ``pszInterfaceName`` - interface name
180
-- ``ppszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
181
-
182
-**Returns**
183
-
184
-- success: 0
185
-- failure: error code
186
-
187
-## nm_set_link_mode
188
-
189
-**Description**
190
-
191
-Set the mode of the interface (auto or manual).
192
-
193
-**Declaration**
194
-~~~~
195
-uint32_t
196
- nm_set_link_mode(
197
-     const char \*pszInterfaceName,
198
-     NET_LINK_MODE mode
199
- );
200
-~~~~
201
-**Arguments**
202
-
203
-- ``pszInterfaceName`` - interface name
204
-- ``mode`` - link mode. One of the following values:
205
-  - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
206
-  - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
207
-  - ``LINK_MODE_UNKNOWN`` - the link mode is unknown
208
-
209
-**Returns**
210
-
211
-- success: 0
212
-- failure: error code
213
-
214
-## nm_get_link_mode
215
-
216
-**Description**
217
-
218
-Get the mode of the interface (auto or manual).
219
-
220
-**Declaration**
221
-~~~~
222
-uint32_t
223
- nm_get_link_mode(
224
-     const char \*pszInterfaceName,
225
-     NET_LINK_MODE \*pLinkMode
226
- );
227
-~~~~
228
-**Arguments**
229
-
230
-- ``pszInterfaceName`` - interface name
231
-- ``pLinkMode`` - link mode. One of the following values:
232
-  - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
233
-  - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
234
-  - ``LINK_MODE_UNKNOWN`` - the link mode is unknown
235
-
236
-**Returns**
237
-
238
-- success: 0
239
-- failure: error code
240
-
241
-## nm_set_link_mtu
242
-
243
-**Description**
244
-
245
-Set the maximum transmission unit (MTU) of the interface.
246
-
247
-**Declaration**
248
-~~~~
249
-uint32_t
250
- nm_set_link_mtu(
251
-     const char \*pszInterfaceName,
252
-     uint32_t mtu
253
- );
254
-~~~~
255
-**Arguments**
256
-
257
-- ``pszInterfaceName`` - interface name
258
-- ``mtu`` - maximum transmission unit (MTU)
259
-
260
-**Returns**
261
-
262
-- success: 0
263
-- failure: error code
264
-
265
-## nm_get_link_mtu
266
-
267
-**Description**
268
-
269
-Get the maximum transmission unit (MTU) of the interface.
270
-
271
-**Declaration**
272
-~~~~
273
-nm_get_link_mtu
274
- uint32_t
275
- nm_get_link_mtu(
276
-     const char \*pszInterfaceName,
277
-     uint32_t \*pMtu
278
- );
279
-~~~~
280
-**Arguments**
281
-
282
-- ``pszInterfaceName`` - interface name
283
-- ``pMtu`` - maximum transmission unit (MTU)
284
-
285
-**Returns**
286
-
287
-- success: 0
288
-- failure: error code
289
-
290
-## nm_set_link_state
291
-
292
-**Description**
293
-
294
-Set the link state of the interface (up or down).
295
-
296
-**Declaration**
297
-~~~~
298
- uint32_t
299
- nm_set_link_state(
300
-     const char \*pszInterfaceName,
301
-     NET_LINK_STATE state
302
- );
303
-~~~~
304
-**Arguments**
305
-
306
-- ``pszInterfaceName`` - interface name
307
-- ``state`` - link state. One of the following values:
308
-  - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal.
309
-  - ``LINK_UP`` - the link is configured up and has carrier signal.
310
-  - ``LINK_STATE_UNKNOWN`` - the link state is unknown
311
-
312
-**Returns**
313
-
314
-- success: 0
315
-- failure: error code
316
-
317
-## nm_get_link_state
318
-
319
-**Description**
320
-
321
-Get the link state of the interface (up or down).
322
-
323
-**Declaration**
324
-~~~~
325
-uint32_t
326
- nm_get_link_state(
327
-     const char \*pszInterfaceName,
328
-     NET_LINK_STATE \*pLinkState
329
- );
330
-~~~~
331
-**Arguments**
332
-
333
-- ``pszInterfaceName`` - interface name
334
-- ``pLinkState`` - link state. One of the following values:
335
-  - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal
336
-  - ``LINK_UP`` - the link is configured up and has carrier signal
337
-  - ``LINK_STATE_UNKNOWN`` - the link state is unknown
338
-
339
-**Returns**
340
-
341
-- success: 0
342
-- failure: error code
343
-
344
-## nm_ifup
345
-
346
-**Description**
347
-
348
-Set the specified interface state to UP. Additionally, if the interface is configured to have an IP address, it waits for the interface to acquire the IP address, and then updates neighbors of its IP address via the address resolution protocol (ARP) messages.
349
-
350
-**Declaration**
351
-~~~~
352
- uint32_t
353
- nm_ifup(
354
-     const char \*pszInterfaceName
355
- );
356
-~~~~
357
-**Arguments**
358
-
359
-- ``pszInterfaceName`` - interface name
360
-
361
-**Returns**
362
-
363
-- success: 0
364
-- failure: error code
365
-
366
-## nm_ifdown
367
-
368
-**Description**
369
-
370
-Set the specified interface state to DOWN.
371
-
372
-**Declaration**
373
-~~~~
374
-uint32_t
375
- nm_ifdown(
376
-     const char \*pszInterfaceName
377
- );
378
-~~~~
379
-**Arguments**
380
-
381
-- ``pszInterfaceName`` - interface name
382
-
383
-**Returns**
384
-
385
-- success: 0
386
-- failure: error code
387
-
388
-## nm_get_link_info
389
-
390
-**Description**
391
-
392
-Get link information for the interface. The caller is responsible for freeing ppLinkInfo by calling nm_free_link_info.
393
-
394
-**Declaration**
395
-~~~~
396
-uint32_t
397
- nm_get_link_info(
398
-     const char \*pszInterfaceName,
399
-     NET_LINK_INFO \*\*ppLinkInfo
400
- );
401
-~~~~
402
-**Arguments**
403
-
404
-- ``pszInterfaceName`` - interface name
405
-- ``ppLinkInfo``, which includes the following information:
406
-  - \*``pszInterfaceName`` - interface name
407
-  - \*``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
408
-  - ``mtu`` - maximum transmission unit (MTU)
409
-  - ``mode`` - One of the following values:
410
-    - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
411
-    - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
412
-    - ``LINK_MODE_UNKNOWN`` - the link mode is unknown
413
-  - ``state`` - One of the following values:
414
-    - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal
415
-    - ``LINK_UP`` - the link is configured up and has carrier signal
416
-    - ``LINK_STATE_UNKNOWN`` - the link state is unknown
417
-
418
-**Returns**
419
-
420
-- success: 0
421
-- failure: error code
422
-
423
-## nm_free_link_info
424
-
425
-**Description**
426
-
427
-Frees the NET_LINK_INFO structure returned by a successful nm_get_link_info call.
428
-
429
-**Declaration**
430
-~~~~
431
-void
432
- nm_free_link_info(
433
-     NET_LINK_INFO \*pNetLinkInfo
434
- );
435
-~~~~
436
-**Arguments**
437
-
438
-- ``pNetLinkInfo``, which includes the following information:
439
-  - \*``pszInterfaceName`` - interface name
440
-  - \*``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
441
-  - ``mtu`` - maximum transmission unit (MTU)
442
-  - ``mode`` - One of the following values:
443
-    - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
444
-    - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
445
-    - ``LINK_MODE_UNKNOWN`` - the link mode is unknown
446
-  - ``state`` - One of the following values:
447
-    - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal
448
-    - ``LINK_UP`` - the link is configured up and has carrier signal
449
-    - ``LINK_STATE_UNKNOWN`` - the link state is unknown
450
-
451
-**Returns**
452
-
453
-- success: 0
454
-- failure: error code
455
-
456
-# IP Address Configuration APIs
457
-
458
-The Photon OS 2.0 network manager C API enables you to manage IP addresses for interfaces that are managed by systemd network manager.
459
-
460
-## Structure Declarations
461
-
462
-### IP Address Mode
463
-
464
-**Description**
465
-
466
-Defines the IP address mode. One of the following values:
467
-
468
-- ``IPV4_ADDR_MODE_NONE`` - no IPv4 address configured on the interface
469
-- ``IPV4_ADDR_MODE_STATIC`` - the interface is configured with a static IPv4 address
470
-- ``IPV4_ADDR_MODE_DHCP`` -  the interface is configured with a DHCP IPv4 address
471
-
472
-**Declaration**
473
-~~~~
474
- typedef enum _NET_IPV4_ADDR_MODE
475
- {
476
-     IPV4_ADDR_MODE_NONE = 0,
477
-     IPV4_ADDR_MODE_STATIC,
478
-     IPV4_ADDR_MODE_DHCP,
479
-     IPV4_ADDR_MODE_MAX
480
- } NET_IPV4_ADDR_MODE;
481
-~~~~
482
-### Address Type
483
-
484
-**Description**
485
-
486
-Defines the type of IP address. One of the following options:
487
-
488
-- ``STATIC_IPV4`` - static IPv4 address
489
-- ``STATIC_IPV6`` - static IPv6 address
490
-- ``DHCP_IPV4`` - DHCP IPv4 address
491
-- ``DHCP_IPV6`` - DHCP IPv6 address
492
-- ``AUTO_IPV6`` - stateless dynamic IPv6 address
493
-- ``LINK_LOCAL_IPV6`` - link local IPv6 address
494
-
495
-**Declaration**
496
-~~~~
497
- typedef enum _NET_ADDR_TYPE
498
- {
499
-     STATIC_IPV4        =  0x00000001,
500
-     STATIC_IPV6        =  0x00000002,
501
-     DHCP_IPV4          =  0x00000010,
502
-     DHCP_IPV6          =  0x00000020,
503
-     AUTO_IPV6          =  0x00000040,
504
-     LINK_LOCAL_IPV6    =  0x00000080,
505
- } NET_ADDR_TYPE;
506
-~~~~
507
-### IP Addresses
508
-
509
-**Description**
510
-
511
-Defines IP addresses.
512
-
513
-- ``pszInterfaceName`` - interface name
514
-- ``type`` - address type
515
-- ``pszIPAddrPrefix`` - IP address
516
-
517
-**Declarations**
518
-~~~~
519
- typedef struct _NET_IP_ADDR
520
- {
521
-     char \*pszInterfaceName;
522
-     NET_ADDR_TYPE type;
523
-     char \*pszIPAddrPrefix;
524
- } NET_IP_ADDR, \*PNET_IP_ADDR;
525
-~~~~
526
-## nm_set_ipv4_addr_gateway
527
-
528
-**Description**
529
-
530
-Set the IPv4 address and (optionally) the default gateway address for the interface.
531
-
532
-**Declaration**
533
-~~~~
534
- uint32_t
535
-
536
- nm_set_ipv4_addr_gateway(
537
-
538
-     const char \*pszInterfaceName,
539
-     NET_IPV4_ADDR_MODE mode,
540
-     const char \*pszIPv4AddrPrefix,
541
-     const char \*pszIPv4Gateway
542
- );
543
-~~~~
544
-**Arguments**
545
-
546
-- ``pszInterfaceName`` - interface name
547
-- ``mode`` - IP address mode; one of the following values:
548
-  - ``IPV4_ADDR_MODE_NONE``
549
-  - ``IPV4_ADDR_MODE_STATIC``
550
-  - ``IPV4_ADDR_MODE_DHCP``
551
-- ``pszIPv4AddrPrefix`` - IPv4 address specified in dot-decimal / prefix notation (for example, 10.10.10.101/23). If the prefix is not specified, then a /32 prefix is assumed.
552
-- ``pszIPv4Gateway`` - IPv4 gateway (optional) specified in the dot-decimal format (for example,10.10.20.30).
553
-
554
-**Returns**
555
-
556
-- success: 0
557
-- failure: error code
558
-
559
-## nm_get_ipv4_addr_gateway
560
-
561
-**Description**
562
-
563
-Get the IPv4 address and the default gateway address for the interface.
564
-
565
-**Declaration**
566
-~~~~
567
-uint32_t
568
- nm_get_ipv4_addr_gateway(
569
-     const char \*pszInterfaceName,
570
-     NET_IPV4_ADDR_MODE \*pMode,
571
-     char \*\*ppszIPv4AddrPrefix,
572
-     char \*\*ppszIPv4Gateway
573
- );
574
-~~~~
575
-**Arguments**
576
-
577
-- ``pszInterfaceName`` - interface name
578
-- ``pmode`` - IP mode; one of the following values:
579
-  - ``IPV4_ADDR_MODE_NONE``
580
-  - ``IPV4_ADDR_MODE_STATIC``
581
-  - ``IPV4_ADDR_MODE_DHCP``
582
-- ``ppszIPv4AddrPrefix`` - IPv4 address returned in dot-decimal / prefix notation (for example, 10.10.10.101/23). If the prefix is not specified, then a /32 prefix is assumed.
583
-- ``ppszIPv4Gateway`` - IPv4 gateway (optional) returned in the dot-decimal format (for example,10.10.10.250).
584
-
585
-**Returns**
586
-
587
-- success: 0
588
-- failure: error code
589
-
590
-## nm_add_static_ipv6_addr
591
-
592
-**Description**
593
-
594
-Add an IPv6 address to the specified interface.
595
-
596
-**Declaration**
597
-~~~~
598
-uint32_t
599
- nm_add_static_ipv6_addr(
600
-     const char \*pszInterfaceName,
601
-     const char \*pszIPv6AddrPrefix
602
- );
603
-~~~~
604
-**Arguments**
605
-
606
-- ``pszInterfaceName`` - interface name
607
-- ``pszIPv6AddrPrefix`` - IPv6 address specified in the standard colon-separated IPv6 address format followed by the prefix (for example, 2010:a1:b2::25/64). If the not prefix is specified, then a /128 prefix is assumed.
608
-
609
-**Returns**
610
-
611
-- success: 0
612
-- failure: error code
613
-
614
-## nm_delete_static_ipv6_addr
615
-
616
-**Description**
617
-
618
-Delete a static IPv6 address from the interface.
619
-
620
-**Declaration**
621
-~~~~
622
-uint32_t
623
- nm_delete_static_ipv6_addr(
624
-     const char \*pszInterfaceName,
625
-     const char \*pszIPv6AddrPrefix
626
- );
627
-~~~~
628
-**Arguments**
629
-
630
-- ``pszInterfaceName`` - interface name
631
-- ``pszIPv6AddrPrefix`` - IPv6 address specified in the standard colon-separated IPv6 address format followed by the prefix (for example, 2010:a1:b2::25/64). If the not prefix is specified, then a /128 prefix is assumed.
632
-
633
-**Returns**
634
-
635
-- success: 0
636
-- failure: error code
637
-
638
-## nm_set_ipv6_addr_mode
639
-
640
-**Description**
641
-
642
-Set the mode for the interface.
643
-
644
-**Declaration**
645
-~~~~
646
-uint32_t
647
- nm_set_ipv6_addr_mode(
648
-     const char \*pszInterfaceName,
649
-     uint32_t enableDhcp,
650
-     uint32_t enableAutoconf
651
- );
652
-~~~~
653
-**Arguments**
654
-
655
-- ``pszInterfaceName`` - interface name
656
-- ``enableDhcp`` - enable (1) or disable (0) DHCP; enabling configures the interface to acquire a DHCP IPv6 address.
657
-- ``enableAutoconf`` - enable (1) or disable (0) autoconf; enabling configures the interface to acquire a stateless autoconfiguration IPv6 address.
658
-
659
-**Returns**
660
-
661
-- success: 0
662
-- failure: error code
663
-
664
-## nm_get_ipv6_addr_mode
665
-
666
-**Description**
667
-
668
-Get the mode for the interface.
669
-
670
-**Declaration**
671
-~~~~
672
- uint32_t
673
- nm_get_ipv6_addr_mode(
674
-     const char \*pszInterfaceName,
675
-     uint32_t \*pDhcpEnabled,
676
-     uint32_t \*pAutoconfEnabled
677
- );
678
-~~~~
679
-**Arguments**
680
-
681
-- ``pszInterfaceName`` - interface name
682
-- ``pDhcpEnabled`` - returns whether IPv6 DHCP is enabled (1) or disabled (0).
683
-- ``pAutoconfEnabled`` - returns whether IPv6 stateless autoconfiguration is enabled (1) or disabled (0).
684
-
685
-**Returns**
686
-
687
-- success: 0
688
-- failure: error code
689
-
690
-## nm_get_ip_addr
691
-
692
-**Description**
693
-
694
-Get the IP address for the interface.
695
-
696
-**Declaration**
697
-~~~~
698
-uint32_t
699
- nm_get_ip_addr(
700
-     const char \*pszInterfaceName,
701
-     uint32_t addrTypes,
702
-     size_t \*pCount,
703
-     NET_IP_ADDR \*\*\*pppIpAddrList
704
- );
705
-~~~~
706
-**Arguments**
707
-
708
-- ``pszInterfaceName`` - interface name
709
-- ``addrTypes`` - type of IP address; one of the following values:
710
-  - ``STATIC_IPV4``
711
-  - ``STATIC_IPV6``
712
-  - ``DHCP_IPV4``
713
-  - ``DHCP_IPV6``
714
-  - ``AUTO_IPV6``
715
-  - ``LINK_LOCAL_IPV6``
716
-- ``pCount`` - number of IP address structures in the pppIpAddrList array returned by the API call.
717
-- ``pppIpAddrList`` - array of NET_IP_ADDR elements that includes the following:
718
-  - ``pszInterfaceName``
719
-  - ``type``
720
-  - ``pszIPAddrPrefix``
721
-
722
-**Returns**
723
-
724
-- success: 0
725
-- failure: error code
726
-
727
-## nm_set_ipv6_gateway
728
-
729
-**Description**
730
-
731
-Set the default IPv6 gateway for the interface.
732
-
733
-**Declaration**
734
-~~~~
735
- uint32_t
736
- nm_set_ipv6_gateway(
737
-     const char \*pszInterfaceName,
738
-     const char \*pszIPv6Gateway
739
- );
740
-~~~~
741
-**Arguments**
742
-
743
-- ``pszInterfaceName`` - interface name
744
-- ``pszIPv6Gateway`` - IPv6 gateway specified in the standard colon-separated IPv6 address format (for example, 2010:125::100)
745
-
746
-**Returns**
747
-
748
-- success: 0
749
-- failure: error code
750
-
751
-## nm_get_ipv6_gateway
752
-
753
-**Description**
754
-
755
-Get the default IPv6 gateway for the interface.
756
-
757
-**Declaration**
758
-~~~~
759
- uint32_t
760
- nm_get_ipv6_gateway(
761
-     const char \*pszInterfaceName,
762
-     char \*\*ppszIPv6Gateway
763
- );
764
-~~~~
765
-**Arguments**
766
-
767
-- ``pszInterfaceName`` - interface name
768
-- ``ppszIPv6Gateway`` - IPv6 gateway specified in the standard colon-separated IPv6 address format (for example, 2010:125::100)
769
-
770
-**Returns**
771
-
772
-- success: 0
773
-- failure: error code
774
-
775
-# Route Configuration APIs
776
-
777
-The Photon OS 2.0 network manager C API enables you to manage static IP routes configuration.
778
-
779
-## Structure Declarations
780
-
781
-### Route Scope
782
-
783
-**Description**
784
-
785
-Defines the scope of a route. One of the following options.
786
-
787
-- ``GLOBAL_ROUTE`` - route to a destination one or more hops away
788
-- ``LINK_ROUTE`` - route to a destination on the local network
789
-- ``HOST_ROUTE`` - route to a destination address on the local host
790
-
791
-**Declaration**
792
-~~~~
793
- typedef enum _NET_ROUTE_SCOPE
794
- {
795
-     GLOBAL_ROUTE = 0,
796
-     LINK_ROUTE,
797
-     HOST_ROUTE,
798
-     NET_ROUTE_SCOPE_MAX
799
- } NET_ROUTE_SCOPE;
800
-~~~~
801
-### IP Route
802
-
803
-**Description**
804
-
805
-Defines an IP route. Includes the following information:
806
-
807
-- ``pszInterfaceName`` - interface through which the specified destination network can be reached
808
-- ``pszDestNetwork`` - destination IP network reached by the specified route
809
-- ``pszSourceNetwork`` - source network for the specified route
810
-- ``pszGateway`` - IP gateway through which the specified destination network can be reached
811
-- ``scope`` - scope of this route entry; one of the following values: GLOBAL_ROUTE, LINK_ROUTE, or HOST_ROUTE as defined above
812
-- ``metric`` - metric of this route, an unsigned integer
813
-- ``table`` - identifier for the route table to which this route belongs.
814
-
815
-**Declaration**
816
-~~~~
817
- typedef struct _NET_IP_ROUTE
818
- {
819
-     char \*pszInterfaceName;
820
-     char \*pszDestNetwork;
821
-     char \*pszSourceNetwork;
822
-     char \*pszGateway;
823
-     NET_ROUTE_SCOPE scope;
824
-     uint32_t metric;
825
-     uint32_t table;
826
- } NET_IP_ROUTE, \*PNET_IP_ROUTE;
827
-~~~~
828
-## nm_add_static_ip_route
829
-
830
-**Description**
831
-
832
-Add a static IP route.
833
-
834
-**Declaration**
835
-~~~~
836
-uint32_t
837
- nm_add_static_ip_route(
838
-     NET_IP_ROUTE \*pRoute
839
- );
840
-~~~~
841
-**Arguments**
842
-
843
-- ``pRoute`` - static IP route
844
-
845
-**Returns**
846
-
847
-- success: 0
848
-- failure: error code
849
-
850
-## nm_delete_static_ip_route
851
-
852
-**Description**
853
-
854
-Delete a static IP route.
855
-
856
-**Declaration**
857
-~~~~
858
- uint32_t
859
- nm_delete_static_ip_route(
860
-     NET_IP_ROUTE \*pRoute
861
- );
862
-~~~~
863
-**Arguments**
864
-
865
-- ``pRoute`` - static IP route
866
-
867
-**Returns**
868
-
869
-- success: 0
870
-- failure: error code
871
-
872
-## nm_get_static_ip_routes
873
-
874
-**Description**
875
-
876
-Get the static IP routes for an interface.
877
-
878
-**Declaration**
879
-~~~~
880
- uint32_t
881
- nm_get_static_ip_routes(
882
-     const char \*pszInterfaceName,
883
-     size_t \*pCount,
884
-     NET_IP_ROUTE \*\*\*pppRouteList
885
- );
886
-~~~~
887
-**Arguments**
888
-
889
-- ``pszInterfaceName`` - interface name
890
-- ``pCount`` - number of NET_IP_ROUTE elements returned in the pppRouteList array by the API call upon success
891
-- ``pppRouteList`` - array of static IP routes
892
-
893
-**Returns**
894
-
895
-- success: 0
896
-- failure: error code
897
-
898
-# DNS Configuration APIs
899
-
900
-The Photon OS 2.0 network manager C API enables you to manage the DNS and Domains configuration.
901
-
902
-## Structure Declarations
903
-
904
-### DNS Mode
905
-
906
-**Description**
907
-
908
-DNS mode. Any of the following values:
909
-
910
-- ``DNS_MODE_INVALID`` - DNS mode is unknown
911
-- ``STATIC_DNS`` - DNS servers are statically configured
912
-- ``DHCP_DNS`` - DNS servers configuration is acquired from DHCP protocol.
913
-
914
-**Declaration**
915
-~~~~
916
- typedef enum _NET_DNS_MODE
917
- {
918
-     DNS_MODE_INVALID = 0,
919
-     STATIC_DNS,
920
-     DHCP_DNS,
921
-     DNS_MODE_MAX,
922
- } NET_DNS_MODE;
923
-~~~~
924
-## nm_set_dns_servers
925
-
926
-**Description**
927
-
928
-Set the DNS servers list for the interface.
929
-
930
-**Declaration**
931
-~~~~
932
-uint32_t
933
- nm_set_dns_servers(
934
-     const char \*pszInterfaceName,
935
-     NET_DNS_MODE mode,
936
-     size_t count,
937
-     const char \*\*ppszDnsServers
938
- );
939
-~~~~
940
-**Arguments**
941
-
942
-- ``pszInterfaceName`` - interface name (optional, can be NULL)
943
-- ``mode`` - DNS mode. One of the following values:
944
-  - ``DNS_MODE_INVALID`` = 0
945
-  - ``DNS_MODE_MA``
946
-  - ``DHCP_DNS``
947
-  - ``STATIC_DNS``
948
-- ``count`` - number of NUL terminated DNS server entries passed in the ppszDnsServers array to the API call (for example, 10.10.10.200 or 2020::40)
949
-- ``ppszDnsServers`` - array of DNS servers
950
-
951
-**Returns**
952
-
953
-- success: 0
954
-- failure: error code
955
-
956
-## nm_add_dns_server
957
-
958
-**Description**
959
-
960
-Add a server to the DNS servers list associated with an interface.
961
-
962
-**Declaration**
963
-~~~~
964
-uint32_t
965
- nm_add_dns_server(
966
-     const char \*pszInterfaceName,
967
-     const char \*pszDnsServer
968
- );
969
-~~~~
970
-**Arguments**
971
-
972
-- ``pszInterfaceName`` - interface name (optional, can be NULL)
973
-- ``ppszDnsServer`` - server to add to the DNS server list
974
-
975
-**Returns**
976
-
977
-- success: 0
978
-- failure: error code
979
-
980
-## nm_delete_dns_server
981
-
982
-**Description**
983
-
984
-Delete a server from the DNS servers list associated with an interface.
985
-
986
-**Declaration**
987
-~~~~
988
- uint32_t
989
- nm_delete_dns_server(
990
-     const char \*pszInterfaceName,
991
-     const char \*pszDnsServer
992
- );
993
-~~~~
994
-**Arguments**
995
-
996
-- ``pszInterfaceName`` - interface name (optional, can be NULL)
997
-- ``ppszDnsServer`` - server to remove from the DNS server list
998
-
999
-**Returns**
1000
-
1001
-- success: 0
1002
-- failure: error code
1003
-
1004
-## nm_get_dns_servers
1005
-
1006
-**Description**
1007
-
1008
-Get the the DNS servers list for the interface.
1009
-
1010
-**Declaration**
1011
-~~~~
1012
-uint32_t
1013
- nm_get_dns_servers(
1014
-     const char \*pszInterfaceName,
1015
-     NET_DNS_MODE \*pMode,
1016
-     size_t \*pCount,
1017
-     char \*\*\*pppszDnsServers
1018
- );
1019
-~~~~
1020
-**Arguments**
1021
-
1022
-- ``pszInterfaceName`` - interface name (optional, can be NULL)
1023
-- ``pMode`` - DNS mode. One of the following values:
1024
-  - ``DNS_MODE_INVALID``
1025
-  - ``DHCP_DNS``
1026
-  - ``STATIC_DNS``
1027
-- ``pCount`` - number of NUL terminated DNS server entries in the pppszDnsServers array returned by the API call (for example, 10.10.10.200 or 2020::40)
1028
-- ``pppszDnsServers`` - array of DNS servers
1029
-
1030
-**Returns**
1031
-
1032
-- success: 0
1033
-- failure: error code
1034
-
1035
-## nm_set_dns_domains
1036
-
1037
-**Description**
1038
-
1039
-Set the DNS domain list.
1040
-
1041
-**Declaration**
1042
-~~~~
1043
-uint32_t
1044
- nm_set_dns_domains(
1045
-     const char \*pszInterfaceName,
1046
-     size_t count,
1047
-     const char \*\*ppszDnsDomains
1048
- );
1049
-~~~~
1050
-**Arguments**
1051
-
1052
-- ``pszInterfaceName`` - interface name (optional, can be NULL)
1053
-- ``count`` - number of DNS domains specified in the ppszDnsDomains array to the API call (for example, if count = 2, then there are two elements: ppszDnsDomains[0] and ppszDnsDomains[1])
1054
-- ``ppszDnsDomains`` - array of DNS domains
1055
-
1056
-**Returns**
1057
-
1058
-- success: 0
1059
-- failure: error code
1060
-
1061
-## nm_add_dns_domain
1062
-
1063
-**Description**
1064
-
1065
-Add a DNS domain to the DNS domain list.
1066
-
1067
-**Declaration**
1068
-~~~~
1069
-uint32_t
1070
- nm_add_dns_domain(
1071
-     const char \*pszInterfaceName,
1072
-     const char \*pszDnsDomain
1073
- );
1074
-~~~~
1075
-**Arguments**
1076
-
1077
-- ``pszInterfaceName`` - interface name (optional, can be NULL)
1078
-- ``pszDnsDomain`` - DNS domain to add to the list
1079
-
1080
-**Returns**
1081
-
1082
-- success: 0
1083
-- failure: error code
1084
-
1085
-## nm_delete_dns_domain
1086
-
1087
-**Description**
1088
-
1089
-Delete a DNS domain from the DNS domain list.
1090
-
1091
-**Declaration**
1092
-~~~~
1093
-uint32_t
1094
- nm_delete_dns_domain(
1095
-     const char \*pszInterfaceName,
1096
-     const char \*pszDnsDomain
1097
- );
1098
-~~~~
1099
-**Arguments**
1100
-
1101
-- ``pszInterfaceName`` - interface name (optional, can be NULL)
1102
-- ``pszDnsDomain`` - DNS domain to remove from the list
1103
-
1104
-**Returns**
1105
-
1106
-- success: 0
1107
-- failure: error code
1108
-
1109
-## nm_get_dns_domains
1110
-
1111
-**Description**
1112
-
1113
-Get the list of DNS domains.
1114
-
1115
-**Declaration**
1116
-~~~~
1117
-uint32_t
1118
- nm_get_dns_domains(
1119
-     const char \*pszInterfaceName,
1120
-     size_t \*pCount,
1121
-     char \*\*\*pppszDnsDomains
1122
- );
1123
-~~~~
1124
-**Arguments**
1125
-
1126
-- ``pszInterfaceName`` - interface name (optional, can be NULL)
1127
-- ``pCount`` - number of DNS domains returned in the pppszDnsDomains from the API call (for example, if count = 2, then there are two elements: ppszDnsDomains[0] and ppszDnsDomains[1])
1128
-- ``pppszDnsDomains`` - array of DNS domains
1129
-
1130
-**Returns**
1131
-
1132
-- success: 0
1133
-- failure: error code
1134
-
1135
-# DHCP Options DUID and IAID Configuration APIs
1136
-
1137
-The Photon OS 2.0 network manager C API enables you to manage DHCP DUID and Interface IAID.
1138
-
1139
-## nm_set_iaid
1140
-
1141
-**Description**
1142
-
1143
-Set the IAID for the interface.
1144
-
1145
-**Declaration**
1146
-~~~~
1147
-uint32_t
1148
- nm_set_iaid(
1149
-     const char \*pszInterfaceName,
1150
-     uint32_t iaid
1151
- );
1152
-~~~~
1153
-**Arguments**
1154
-
1155
-- ``pszInterfaceName`` - interface name
1156
-- ``iaid`` - interface association identifier (IAID)
1157
-
1158
-**Returns**
1159
-
1160
-- success: 0
1161
-- failure: error code
1162
-
1163
-## nm_get_iaid
1164
-
1165
-**Description**
1166
-
1167
-Get the IAID for the interface.
1168
-
1169
-**Declaration**
1170
-~~~~
1171
-uint32_t
1172
- nm_get_iaid(
1173
-     const char \*pszInterfaceName,
1174
-     uint32_t \*pIaid
1175
- );
1176
-~~~~
1177
-**Arguments**
1178
-
1179
-- ``pszInterfaceName`` - interface name
1180
-- ``pIaid`` - interface association identifier (IAID)
1181
-
1182
-**Returns**
1183
-
1184
-- success: 0
1185
-- failure: error code
1186
-
1187
-## nm_set_duid
1188
-
1189
-**Description**
1190
-
1191
-Set the DUID for the interface.
1192
-
1193
-**Declaration**
1194
-~~~~
1195
-uint32_t
1196
- nm_set_duid(
1197
-     const char \*pszInterfaceName,
1198
-     const char \*pszDuid
1199
- );
1200
-~~~~
1201
-**Arguments**
1202
-
1203
-- ``pszInterfaceName`` - interface name (optional, specify NULL to set system global DUID configuration)
1204
-- ``pszDuid`` - DHCP unique identifier (DUID)
1205
-
1206
-**Returns**
1207
-
1208
-- success: 0
1209
-- failure: error code
1210
-
1211
-## nm_get_duid
1212
-
1213
-**Description**
1214
-
1215
-Get the DUID for the interface.
1216
-
1217
-**Declaration**
1218
-~~~~
1219
-uint32_t
1220
- nm_get_duid(
1221
-     const char \*pszInterfaceName,
1222
-     char \*\*ppszDuid
1223
- );
1224
-~~~~
1225
-**Arguments**
1226
-
1227
-- ``pszInterfaceName`` - interface name (optional, specify NULL to query system global DUID configuration)
1228
-- ``ppszDuid`` - DHCP unique identifier (DUID)
1229
-
1230
-**Returns**
1231
-
1232
-- success: 0
1233
-- failure: error code
1234
-
1235
-# NTP Configuration APIs
1236
-
1237
-The Photon OS 2.0 network manager C API enables you to manage NTP servers configured for the system.
1238
-
1239
-## nm_set_ntp_servers
1240
-
1241
-**Description**
1242
-
1243
-Set the list of NTP servers.
1244
-
1245
-**Declaration**
1246
-~~~~
1247
- uint32_t
1248
- nm_set_ntp_servers(
1249
-     size_t count,
1250
-     const char \*\*ppszNtpServers
1251
- );
1252
-~~~~
1253
-**Arguments**
1254
-
1255
-- ``count`` - number of NTP servers in the ppszNtpServers array passed to the API call.
1256
-- ``ppszNtpServers`` - array of NTP servers
1257
-
1258
-**Returns**
1259
-
1260
-- success: 0
1261
-- failure: error code
1262
-
1263
-## nm_add_ntp_servers
1264
-
1265
-**Description**
1266
-
1267
-Add a server to the NTP servers list.
1268
-
1269
-**Declaration**
1270
-~~~~
1271
- uint32_t
1272
- nm_add_ntp_servers(
1273
-     size_t count,
1274
-     const char \*\*ppszNtpServers
1275
- );
1276
-~~~~
1277
-**Arguments**
1278
-
1279
-- ``count`` - number of NTP servers to add (specified in the ppszNtpServers array) passed to the API call.
1280
-- ``ppszNtpServers`` - array of NTP servers to add
1281
-
1282
-**Returns**
1283
-
1284
-- success: 0
1285
-- failure: error code
1286
-
1287
-## nm_delete_ntp_servers
1288
-
1289
-**Description**
1290
-
1291
-Delete a server from the NTP servers list.
1292
-
1293
-**Declaration**
1294
-~~~~
1295
- uint32_t
1296
- nm_delete_ntp_servers(
1297
-     size_t count,
1298
-     const char \*\*ppszNtpServers
1299
- );
1300
-~~~~
1301
-**Arguments**
1302
-
1303
-- ``count`` - number of NTP servers to delete (specified in the ppszNtpServers array) passed to the API call
1304
-- ``ppszNtpServers`` - array of NTP servers to delete
1305
-
1306
-**Returns**
1307
-
1308
-- success: 0
1309
-- failure: error code
1310
-
1311
-## nm_get_ntp_servers
1312
-
1313
-**Description**
1314
-
1315
-Get the NTP servers list.
1316
-
1317
-**Declaration**
1318
-~~~~
1319
- uint32_t
1320
- nm_get_ntp_servers(
1321
-     size_t \*pCount,
1322
-     char \*\*\*pppszNtpServers
1323
- );
1324
-~~~~
1325
-**Arguments**
1326
-
1327
-- ``pCount`` - number of NTP servers in the pppszNtpServers array returned from the API call
1328
-- ``pppszNtpServers`` - array of NTP servers
1329
-
1330
-**Returns**
1331
-
1332
-- success: 0
1333
-- failure: error code
1334
-
1335
-Other APIs
1336
-
1337
-## nm_set_hostname
1338
-
1339
-**Description**
1340
-
1341
-Set the host name for the system.
1342
-
1343
-**Declaration**
1344
-~~~~
1345
- uint32_t
1346
- nm_set_hostname(
1347
-     const char \*pszHostname
1348
- );
1349
-~~~~
1350
-**Arguments**
1351
-
1352
-- ``pszHostname`` - host name
1353
-
1354
-**Returns**
1355
-
1356
-- success: 0
1357
-- failure: error code
1358
-
1359
-## nm_get_hostname
1360
-
1361
-**Description**
1362
-
1363
-Get the host name for the system.
1364
-
1365
-**Declaration**
1366
-~~~~
1367
- uint32_t
1368
- nm_get_hostname(
1369
-     char \*\*ppszHostname
1370
- );
1371
-~~~~
1372
-**Arguments**
1373
-
1374
-- ``ppszHostname`` - host name
1375
-
1376
-**Returns**
1377
-
1378
-- success: 0
1379
-- failure: error code
1380
-
1381
-## nm_wait_for_link_up
1382
-
1383
-**Description**
1384
-
1385
-Wait for the specified interface to come up.
1386
-
1387
-**Declaration**
1388
-~~~~
1389
- uint32_t
1390
- nm_wait_for_link_up(
1391
-     const char \*pszInterfaceName,
1392
-     uint32_t timeout
1393
- );
1394
-~~~~
1395
-**Arguments**
1396
-
1397
-- ``pszInterfaceName`` - interface name
1398
-- ``timeout`` - maximum time (in seconds) to wait (until the link is up) before timing out of the request; specify 0 for no timeout (wait indefinitely)
1399
-
1400
-**Returns**
1401
-
1402
-- success: 0
1403
-- failure: error code
1404
-
1405
-## nm_wait_for_ip
1406
-
1407
-**Description**
1408
-
1409
-Wait for the interface to acquire an IP address of the specified IP address type.
1410
-
1411
-**Declaration**
1412
-~~~~
1413
- uint32_t
1414
- nm_wait_for_ip(
1415
-     const char \*pszInterfaceName,
1416
-     uint32_t timeout,
1417
-     NET_ADDR_TYPE addrTypes
1418
- );
1419
-~~~~
1420
-**Arguments**
1421
-
1422
-- ``pszInterfaceName`` - interface name
1423
-- ``timeout`` - maximum time (in seconds) to wait (until the link has an IP address of the specified address type) before timing out of the request; specify 0 for no timeout (wait indefinitely)
1424
-- ``addrTypes`` - type of IP address; one of the following values:
1425
-  - ``STATIC_IPV4``
1426
-  - ``STATIC_IPV6``
1427
-  - ``DHCP_IPV4``
1428
-  - ``DHCP_IPV6``
1429
-  - ``AUTO_IPV6``
1430
-  - ``LINK_LOCAL_IPV6``
1431
-
1432
-**Returns**
1433
-
1434
-- success: 0
1435
-- failure: error code
1436
-
1437
-## nm_set_network_param
1438
-
1439
-**Description**
1440
-
1441
-Set the value of a network parameter for an object.
1442
-
1443
-**Declaration**
1444
-~~~~
1445
-uint32_t
1446
- nm_set_network_param(
1447
-     const char \*pszObjectName,
1448
-     const char \*pszParamName,
1449
-     const char \*pszParamValue
1450
- );
1451
-~~~~
1452
-**Arguments**
1453
-
1454
-- ``pszObjectName`` - an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf)
1455
-- ``pszParamName`` - name of a parameter associated with the object; specified in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html))
1456
-- ``pszParamValue`` - points to the parameter value to set; you can add (+) or remove (-) a parameter by prepending the parameter name with + or -. For example:
1457
-
1458
-netmgr net_info --set --object eth1 --paramname +Network_Address --paramvalue "10.10.10.1/24"
1459
-
1460
-**Returns**
1461
-
1462
-- success: 0
1463
-- failure: error code
1464
-
1465
-## nm_get_network_param
1466
-
1467
-**Description**
1468
-
1469
-Get the value of a network parameter associated with an object.
1470
-
1471
-**Declaration**
1472
-~~~~
1473
- uint32_t
1474
- nm_get_network_param(
1475
-     const char \*pszObjectName,
1476
-     const char \*pszParamName,
1477
-     char \*\*ppszParamValue
1478
- );
1479
-~~~~
1480
-**Arguments**
1481
-
1482
-- ``pszObjectName`` - an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf)
1483
-- ``pszParamName`` - name of a parameter associated with the object; returned in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in  [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html))
1484
-- ``ppszParamValue`` - parameter value
1485
-
1486
-**Returns**
1487
-
1488
-- success: 0
1489
-- failure: error code
1490
-
1491
-# Service Management APIs
1492
-
1493
-## nm_stop_network_service
1494
-
1495
-**Description**
1496
-
1497
-Stop the network service.
1498
-
1499
-**Declaration**
1500
-~~~~
1501
- uint32_t
1502
- nm_stop_network_service();
1503
-~~~~
1504
-**Returns**
1505
-
1506
-- success: 0
1507
-- failure: error code
1508
-
1509
-## nm_restart_network_service
1510
-
1511
-**Description**
1512
-
1513
-Restart the network service.
1514
-
1515
-**Declaration**
1516
-~~~~
1517
- uint32_t
1518
- nm_restart_network_service();
1519
-~~~~
1520
-**Returns**
1521
-
1522
-- success: 0
1523
-- failure: error code
1524
-
1525
-nm_stop_dns_service
1526
-
1527
-**Description**
1528
-
1529
-Stop the DNS service.
1530
-
1531
-**Declaration**
1532
-~~~~
1533
-uint32_t
1534
- nm_stop_dns_service();
1535
-~~~~
1536
-**Returns**
1537
-
1538
-- success: 0
1539
-- failure: error code
1540
-
1541
-## nm_restart_dns_service
1542
-
1543
-**Description**
1544
-
1545
-Restart the DNS service.
1546
-
1547
-**Declaration**
1548
-~~~~
1549
- uint32_t
1550
- nm_restart_dns_service();
1551
-~~~~
1552
-**Returns**
1553
-
1554
-- success: 0
1555
-- failure: error code
1556
-
1557
-## nm_stop_ntp_service
1558
-
1559
-**Description**
1560
-
1561
-Stop the NTP service.
1562
-
1563
-**Declaration**
1564
-~~~~
1565
- uint32_t
1566
- nm_stop_ntp_service();
1567
-~~~~
1568
-**Returns**
1569
-
1570
-- success: 0
1571
-- failure: error code
1572
-
1573
-## nm_restart_ntp_service
1574
-
1575
-**Description**
1576
-
1577
-Restart the NTP service.
1578
-
1579
-**Declaration**
1580
-~~~~
1581
- uint32_t
1582
- nm_restart_ntp_service();
1583
-~~~~
1584
-**Returns**
1585
-
1586
-- success: 0
1587
-- failure: error code
1588 1
\ No newline at end of file
1589 2
deleted file mode 100644
... ...
@@ -1,786 +0,0 @@
1
-# Network Configuration Manager - Python API
2
-
3
-Photon OS 2.0 provides a Python API for the Network Configuration Manager.
4
-
5
-- [Setup Instructions](#setup-instructions)
6
-- [Initialization Steps](#initialization-steps)
7
-- [Get Online Help](#get-online-help)
8
-- [Basic Information](#basic-information)
9
-- [Interface Configuration](#interface-configuration)
10
-- [IP Address Configuration](#ip-address-configuration)
11
-- [DNS Configuration](#dns-configuration)
12
-- [DHCP Options, DUID, and IAID Configuration](#dhcp-options-duid-and-iaid-configuration)
13
-- [NTP Servers](#ntp-servers)
14
-
15
-## Setup Instructions
16
-
17
-To set up and run the latest version of the Network Manager API for Python:
18
-
19
-````
20
-# tdnf install pmd pmd-python3
21
-# systemctl start pmd
22
-````
23
-
24
-## Initialization Steps
25
-
26
-````
27
-# python3
28
->>> import pmd
29
->>> net = pmd.server().net
30
-````
31
-## Get Online Help
32
-
33
-Get help for all commands.
34
-````
35
->>> help(net)
36
-````
37
-Get help for a specific command.
38
-````
39
->>> help(net.add_ntp_servers)
40
--in function add_ntp_servers:
41
-add_ntp_servers(...) method of  [server.net](http://server.net/) instance
42
-    net.add_ntp_servers(ntpservers = ["20.20.20.20", "25.30.40.70"])
43
-    adds ntp servers. returns success: 0, failure: exception.
44
-(END)
45
-````
46
-
47
-## Basic Information
48
-
49
-### get_system_network_info
50
-
51
-Get network information details that are common to the entire system.
52
-
53
-**Syntax**
54
-
55
-````
56
-net.get_system_network_info()
57
-````
58
-**Returns**
59
-
60
-- details about the system network (DUID, DNS mode, DNS server list, DNS domain list, NTP server list)
61
-
62
-**Example**
63
-````
64
->>> system_network_info = netmgmt.get_system_network_info()
65
-
66
->>> print ( system_network_info)
67
-
68
-[{DUID: 00:02:11:22:33:44:55:66:77:20, DNS Mode: (null), DNS ServerList: ['10.10.100.100', '20.20.200.10'], DNS domain list: [' [abcd.com](http://abcd.com)'], NTP ServerList: (null)}]
69
-````
70
-
71
-### get_err_info
72
-
73
-Get information about the specified error number.
74
-
75
-**Syntax**
76
-````
77
-net.get_err_info(error = <error_number>)
78
-````
79
-**Parameters**
80
-
81
-- error - error number
82
-
83
-Here is the list of error numbers:
84
-
85
-- 4097 - invalid parameter
86
-- 4098 - not supported
87
-- 4099 - out of memory
88
-- 4100 - value not found
89
-- 4101 - value exists
90
-- 4102 - invalid interface
91
-- 4103 - invalid mode
92
-- 4104 - bad configuration file
93
-- 4105 - write failed
94
-- 4106 - timout
95
-- 4107 - DCHP timeout
96
-
97
-**Returns**
98
-
99
-- success: 0
100
-- failure: exception
101
-
102
-Example
103
-````
104
->> net.get_err_info(error = 4097)
105
-
106
-'invalid parameter'
107
-````
108
-## Interface Configuration
109
-
110
-Use these commands to manage the configuration for a network interface.
111
-
112
-### get_link_info
113
-
114
-Get the link info for the specified interface or for all interfaces (if no interface is specified).
115
-
116
-**Syntax**
117
-````
118
-net.get_link_info(ifname = interface_name)
119
-````
120
-**Parameters**
121
-
122
-- ``ifname`` - interface name (optional)
123
-
124
-**Returns**
125
-
126
-- success: link info
127
-- failure: exception
128
-
129
-### get_link_macaddr
130
-
131
-Get the MAC address for the specified interface or for all interfaces (if no interface is specified).
132
-
133
-**Syntax**
134
-````
135
-net.get_link_macaddr(ifname = interface_name)
136
-````
137
-**Parameters**
138
-
139
-- ``ifname`` - interface name (optional)
140
-
141
-**Returns**
142
-
143
-- success: MAC address
144
-- failure: exception
145
-
146
-### get_link_mode
147
-
148
-Get the link mode for the specified interface (auto or manual), or for all interfaces (if no interface is specified).
149
-
150
-**Syntax**
151
-````
152
-net.get_link_mode(ifname = interface_name)
153
-````
154
-**Parameters**
155
-
156
-- ``ifname`` - interface name (optional)
157
-
158
-**Returns**
159
-
160
-- success: link mode (auto, manual, or unknown)
161
-- failure: exception
162
-
163
-### get_link_mtu
164
-
165
-Get the MTU of the specified interface or for all interfaces (if no interface is specified).
166
-
167
-**Syntax**
168
-````
169
-net.get_link_mtu(ifname = interface_name)
170
-````
171
-**Parameters**
172
-
173
-- ``ifname`` - interface name (optional)
174
-
175
-**Returns**
176
-
177
-- success: link MTU
178
-- failure: exception
179
-
180
-### get_link_state
181
-
182
-Get the link state of the specified interface or for all interfaces (if no interface is specified).
183
-
184
-**Syntax**
185
-````
186
-net.get_link_state(ifname = interface_name)
187
-````
188
-**Parameters**
189
-
190
-- ``ifname`` - interface name (optional)
191
-
192
-**Returns**
193
-
194
-- success: link state (up, down, unknown)
195
-- failure: exception
196
-
197
-### set_link_down
198
-
199
-Bring down the specified interface.
200
-
201
-**Syntax**
202
-
203
-````
204
-net.set_link_down(ifname = interface_name)
205
-````
206
-**Parameters**
207
-
208
-- ``ifname`` - interface name
209
-
210
-**Returns**
211
-
212
-- success: 0
213
-- failure: exception
214
-
215
-### set_link_macaddr
216
-
217
-Set the MAC address of the specified interface.
218
-
219
-**Syntax**
220
-````
221
-net.set_link_macaddr(ifname = interface_name, macaddr = mac_address)
222
-````
223
-**Parameters**
224
-
225
-- ``ifname`` - interface name
226
-- ``macaddr`` = MAC address
227
-
228
-**Returns**
229
-
230
-- success: 0
231
-- failure: exception
232
-
233
-### set_link_mode
234
-
235
-Set the mode (auto or manual) of the specifed interface.
236
-
237
-**Syntax**
238
-````
239
-net.set_link_mode(ifname = interface_name, link_mode = [auto, manual])
240
-````
241
-**Parameters**
242
-
243
-- ``ifname`` - interface name
244
-- ``link_mode`` - auto or manual
245
-
246
-**Returns**
247
-
248
-- success: 0
249
-- failure: exception
250
-
251
-### set_link_mtu
252
-
253
-Set the MTU for the specified interface.
254
-
255
-**Syntax**
256
-````
257
-net.set_link_mtu(ifname = interface_name, mtu = mtu)
258
-````
259
-**Parameters**
260
-
261
-- ``ifname`` - interface name
262
-- ``mtu`` - ``mtu``
263
-
264
-**Returns**
265
-
266
-- success: 0
267
-- failure: exception
268
-
269
-### set_link_state
270
-
271
-Set the state (up or down) of the specified interface.
272
-
273
-**Syntax**
274
-````
275
-net.set_link_state(ifname = interface_name, link_state = [down, up])
276
-````
277
-**Parameters**
278
-
279
-- ``ifname`` - interface name
280
-- ``link_state`` - down or up
281
-
282
-**Returns**
283
-
284
-- success: 0
285
-- failure: exception
286
-
287
-### set_link_up
288
-
289
-Brings up the specified interface.
290
-
291
-**Syntax**
292
-````
293
-net.set_link_up(ifname = interface_name)
294
-````
295
-**Parameters**
296
-
297
-- ``ifname`` - interface name
298
-- ``link_state`` - down or up
299
-
300
-**Returns**
301
-
302
-- success: 0
303
-- failure: exception
304
-
305
-## IP Address Configuration
306
-
307
-Use these commands to manage IP address configuration for a network interface.
308
-
309
-### add_static_ipv6_addr
310
-
311
-Add a static IPv6 address to the specified interface.
312
-
313
-**Syntax**
314
-````
315
-net.add_static_ipv6_addr(ifname = interface_name, addr_prefix = ipv6address_prefix)
316
-````
317
-**Parameters**
318
-
319
-- ``ifname`` - interface name
320
-- ``addr_prefix`` - IPv6 address prefix
321
-
322
-**Returns**
323
-
324
-- success: 0
325
-- failure: exception
326
-
327
-### del_static_ipv6_addr
328
-
329
-Delete a static IPv6 address from the specified interface.
330
-
331
-**Syntax**
332
-````
333
-net.del_static_ipv6_addr(ifname = interface_name, addr_prefix = ipv6address_prefix)
334
-````
335
-**Parameters**
336
-
337
-- ``ifname`` - interface name
338
-- ``addr_prefix`` - IPv6 address prefix
339
-
340
-**Returns**
341
-
342
-- success: 0
343
-- failure: exception
344
-
345
-### get_ipv4_addr_gateway
346
-
347
-Get the IPv4 address with the prefix and gateway for the specified interface.
348
-
349
-**Syntax**
350
-````
351
-net.get_ipv4_addr_gateway(ifname = interface_name)
352
-````
353
-**Parameters**
354
-
355
-- ``ifname`` - interface name
356
-
357
-**Returns**
358
-
359
-- success: IPv4 address with the prefix and gateway
360
-- failure: exception
361
-
362
-### get_ipv6_addr
363
-
364
-Get the list of IPv6 addresses for the specified interface.
365
-
366
-**Syntax**
367
-````
368
-net.get_ipv6_addr(ifname = interface_name)
369
-````
370
-**Parameters**
371
-
372
-- ``ifname`` - interface name
373
-
374
-**Returns**
375
-
376
-- success: IPv6 address list
377
-- failure: exception
378
-
379
-### get_ipv6_addr_mode
380
-
381
-Get the address mode for the specified interface to determine whether DHCPv6, autoconf are enabled or disabled.
382
-
383
-**Syntax**
384
-````
385
-net.get_ipv6_addr_mode(ifname = interface_name)
386
-````
387
-**Parameters**
388
-
389
-- ``ifname`` - interface name
390
-
391
-**Returns**
392
-
393
-- Status for DHCPv6, autoconf (True=enabled, False=disabled)
394
-- failure: exception
395
-
396
-### get_ipv6_gateway
397
-
398
-Get the IPv6 gateway for the specified interface.
399
-
400
-**Syntax**
401
-````
402
-net.get_ipv6_gateway(ifname = interface_name)
403
-````
404
-**Parameters**
405
-
406
-- ``ifname`` - interface name
407
-
408
-**Returns**
409
-
410
-- success: IPv6 gateway
411
-- failure: exception
412
-
413
-### set_ipv4_addr_gateway
414
-
415
-Set the IPv4 address with the prefix and gateway for the specified interface.
416
-
417
-**Syntax**
418
-````
419
-net.get_ipv4_addr_gateway(ifname = interface_name, addr_mode = [dhcp, static, none], addr_prefix = ipv4addressprefix, gateway = ipv4gateway)
420
-````
421
-**Parameters**
422
-
423
-- ``ifname`` - interface name
424
-- ``addr_mode`` - address mode - dhcp, static, or none
425
-- ``addr_prefix`` -  IPv4 address or prefix
426
-- ``gateway`` - IPv4 gateway
427
-
428
-**Returns**
429
-
430
-- success: 0
431
-- failure: exception
432
-
433
-### set_ipv6_addr_mode
434
-
435
-Set the address mode for the specified interface.
436
-
437
-**Syntax**
438
-````
439
-net.set_ipv6_addr_mode(ifname = interface_name, enable_dhcp = [True, False], enable_autoconf = [True, False])
440
-````
441
-**Parameters**
442
-
443
-- ``ifname`` - interface name
444
-- ``enable_dhcp`` - True to enable, False to disable
445
-- ``enable_autoconf`` - True to enable, False to disable
446
-
447
-**Returns**
448
-
449
-- success: 0
450
-- failure: exception
451
-
452
-### set_ipv6_gateway
453
-
454
-Set the IPv6 gateway for the specified interface.
455
-
456
-**Syntax**
457
-````
458
-net.set_ipv6_gateway(ifname = interface_name, gateway = ipv6gateway)
459
-````
460
-**Parameters**
461
-
462
-- ``ifname`` - interface name
463
-- ``gateway`` - IPv6 gateway
464
-
465
-**Returns**
466
-
467
-- success: 0
468
-- failure: exception
469
-
470
-## DNS Configuration
471
-
472
-Use these commands to manage DNS domains and servers for a network interface.
473
-
474
-### get_dns_domains
475
-
476
-Get the list of DNS domains for the specified interface.
477
-
478
-**Syntax**
479
-````
480
-net.get_dns_domains(ifname = interface_name)
481
-````
482
-**Parameters**
483
-
484
-- ``ifname`` - interface name
485
-
486
-**Returns**
487
-
488
-- success: list of DNS domains
489
-- failure: exception
490
-
491
-### get_dns_servers
492
-
493
-Get the list of DNS servers and the mode for the specified interface.
494
-
495
-**Syntax**
496
-````
497
-net.get_dns_servers(ifname = interface_name)
498
-````
499
-**Parameters**
500
-
501
-- ``ifname`` - interface name
502
-
503
-**Returns**
504
-
505
-- success: list of DNS servers and mode
506
-- failure: exception
507
-
508
-### set_dns_domains
509
-
510
-Set the list of DNS domains for the specified interface.
511
-
512
-**Syntax**
513
-````
514
-net.set_dns_domains(domains = ["domain1","domain2",...], ifname = interface_name)
515
-````
516
-**Parameters**
517
-
518
-- ``domains`` - comma-separated list of one or more domains
519
-- ``ifname`` - interface name
520
-
521
-**Returns**
522
-
523
-- success: 0
524
-- failure: exception
525
-
526
-### set_dns_servers
527
-
528
-Set the list of DNS servers for the specified interface.
529
-
530
-**Syntax**
531
-````
532
-net.set_dns_servers(dns_mode = [dhcp, static], servers = ["server1","server2", ...], ifname = interface_name)
533
-````
534
-**Parameters**
535
-
536
-- ``dns_mode`` - dhcp or static
537
-- ``servers`` - comma-separate list of one or more servers
538
-- ``ifname`` - interface name
539
-
540
-**Returns**
541
-
542
-- success: 0
543
-- failure: exception
544
-
545
-## DHCP Options DUID and IAID Configuration
546
-
547
-### get_link_iaid
548
-
549
-Get the IAID for the specified interface.
550
-
551
-**Syntax**
552
-````
553
-net.get_link_iaid(ifname = interface)
554
-````
555
-**Parameters**
556
-
557
-- ``ifname`` - interface name
558
-
559
-**Returns**
560
-
561
-- success: IAID
562
-- failure: exception
563
-
564
-### set_link_iaid
565
-
566
-Set the IAID for the specified interface.
567
-
568
-**Syntax**
569
-````
570
-net.set_link_iaid(ifname = interface_name, iaid = <iaid>)
571
-````
572
-**Parameters**
573
-
574
-- ``ifname`` - interface name
575
-- iaid - IAID
576
-
577
-**Returns**
578
-
579
-- success: 0
580
-- failure: exception
581
-
582
-### get_dhcp_duid
583
-
584
-Get the DCHP DUID.
585
-
586
-**Syntax**
587
-````
588
-net.get_dhcp_duid(ifname = interface_name)
589
-````
590
-**Parameters**
591
-
592
-- ``ifname`` - interface name (optional)
593
-
594
-**Returns**
595
-
596
-- success: DUID
597
-- failure: exception
598
-
599
-### set_dhcp_duid
600
-
601
-Set the DCHP DUID.
602
-
603
-**Syntax**
604
-````
605
-net.set_dhcp_duid(ifname = interface_name duid = duid)
606
-````
607
-**Parameters**
608
-
609
-- ``ifname`` - interface name (optional)
610
-- ``duid`` - DUID to set
611
-
612
-**Returns**
613
-
614
-- success: 0
615
-- failure: exception
616
-
617
-## NTP Servers
618
-
619
-Use these commands to manage the NTP servers list.
620
-
621
-### add_ntp_servers
622
-
623
-Add one or more NTP servers to the NTP servers list.
624
-
625
-**Syntax**
626
-````
627
-net.add_ntp_servers(ntpservers = ["server1", "server2", ...])
628
-````
629
-**Parameters**
630
-
631
-- ``ntpservers`` - Comma-separated list of NTP servers to add to the list.
632
-
633
-**Returns**
634
-
635
-- success: 0
636
-- failure: exception
637
-
638
-### del_ntp_servers
639
-
640
-Remove one or more NTP servers from the NTP servers list.
641
-
642
-**Syntax**
643
-````
644
-net.del_ntp_servers(ntpservers = ["server1", "server2", ...])
645
-````
646
-**Parameters**
647
-
648
-- ``ntpservers`` - Comma-separated list of NTP servers to remove from the list.
649
-
650
-**Returns**
651
-
652
-- success: 0
653
-- failure: exception
654
-
655
-### get_ntp_servers
656
-
657
-Get the NTP servers list.
658
-
659
-**Syntax**
660
-````
661
-net.get_ntp_servers()
662
-````
663
-**Returns**
664
-
665
-- success: NTP servers list
666
-- failure: exception
667
-
668
-### set_ntp_servers
669
-
670
-Set the NTP servers list.
671
-
672
-**Syntax**
673
-````
674
-net.set_ntp_servers(ntpservers = ["server1", "server2", ...])
675
-````
676
-**Parameters**
677
-
678
-- ``ntpservers`` - Comma-separated list of NTP servers to set in the list.
679
-
680
-**Returns**
681
-
682
-- success: 0
683
-- failure: exception
684
-
685
-### get_hostname
686
-
687
-Get the host name.
688
-
689
-**Syntax**
690
-
691
-net.get_hostname()
692
-
693
-**Returns**
694
-
695
-- success: host name
696
-- failure: exception
697
-
698
-### set_hostname
699
-
700
-Set the host name.
701
-
702
-**Syntax**
703
-````
704
-net.set_hostname(hostname)
705
-````
706
-**Parameters**
707
-
708
-- ``hostname`` - name to assign to the host
709
-
710
-**Returns**
711
-
712
-- success: 0
713
-- failure: exception
714
-
715
-### wait_for_ip
716
-
717
-Wait for the specified interface to acquire a valid IP address of the specified IP address type.
718
-
719
-**Syntax**
720
-````
721
-net.wait_for_ip(ifname = interface_name, timeout = timeout, addrtypes = [ipv4, ipv6, static_ipv4, static_ipv6, dhcp_ipv4, dhcp_ipv6, auto_ipv6, link_local_ipv6])
722
-````
723
-**Parameters**
724
-
725
-- ``ifname`` - interface name
726
-- ``timeout`` - maximum time (in seconds) to wait (until the link is up) before timing out of the request; specify 0 for no timeout (wait indefinitely)
727
-- ``addrtypes`` - one of the following address types: ipv4, ipv6, static_ipv4, static_ipv6, dhcp_ipv4, dhcp_ipv6, auto_ipv6, or link_local_ipv6
728
-
729
-**Returns**
730
-
731
-- success: 0 (when the link has an IP of the specified type)
732
-- failure: exception (for example, timeout expired)
733
-
734
-### wait_for_link_up
735
-
736
-Wait for the specified interface to come up.
737
-
738
-**Syntax**
739
-````
740
-net.wait_for_link_up(ifname = interface_name, timeout = timeout)
741
-````
742
-**Parameters**
743
-
744
-- ``ifname`` - interface name
745
-- ``timeout`` - maximum time (in seconds) to wait (until the link is up) before timing out of the request; specify 0 for no timeout (wait indefinitely)
746
-
747
-**Returns**
748
-
749
-- success: 0 (when link is up)
750
-- failure: exception (for example, timeout expired)
751
-
752
-### get_network_param
753
-
754
-Get the specified network configuration parameter for the specified interface or filename.
755
-
756
-**Syntax**
757
-````
758
-net.get_network_param(object = IfName or Filename, paramname = SectionName_KeyName)
759
-````
760
-**Parameters**
761
-
762
-- ``object`` - an interface name (for example, &quot;eth0&quot;) or a file name (for example, /etc/systemd/resolved.conf)
763
-- ``paramname`` - name of a parameter associated with the object; specified in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in  [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html))
764
-
765
-**Returns**
766
-
767
-- success: 0
768
-- failure: exception
769
-
770
-### set_network_param
771
-
772
-Set the value of a network configuration parameter for the specified interface or filename.
773
-
774
-**Syntax**
775
-````
776
-net.set_network_param(object = interface_name or filename, paramname = SectionName_KeyName, paramvalue = key_value)
777
-````
778
-**Parameters**
779
-
780
-- ``object`` - an interface name (for example, &quot;eth0&quot;) or a file name (for example, /etc/systemd/resolved.conf)
781
-- ``paramname`` - name of a parameter associated with the object; specified in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in  [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html))
782
-
783
-**Returns**
784
-
785
-- success: 0
786
-- failure: exception
787 1
deleted file mode 100755
... ...
@@ -1,1963 +0,0 @@
1
-# Photon OS Administration Guide
2
-
3
--   [Introduction](#introduction)
4
-    -   [Examining the Packages in the SPECS Directory on
5
-        Github](#examining-the-packages-in-the-specs-directory-on-github)
6
-    -   [Looking at the Differences Between the Minimal and the Full
7
-        Version](#looking-at-the-differences-between-the-minimal-and-the-full-version)
8
-    -   [The Root Account and the `sudo` and `su`
9
-        Commands](#the-root-account-and-the-sudo-and-su-commands)
10
--   [Getting Started with Photon OS 2.0](#getting-started-with-photon-os-20)
11
--   [Quick Start for Photon OS 1.0](#quick-start-for-photon-os-10)
12
-    -   [Obtaining the ISO from Bintray and Creating a Photon OS VM
13
-        in VMware
14
-        Workstation](#obtaining-the-iso-from-bintray-and-creating-a-photon-os-vm-in-vmware-workstation)
15
-    -   [Installing the OVA for the Minimal Version in
16
-        vSphere](#installing-the-ova-for-the-minimal-version-in-vsphere)
17
-    -   [Rapidly Deploying the Photon OS OVA in VMware Workstation
18
-        12
19
-        Pro](#rapidly-deploying-the-photon-os-ova-in-vmware-workstation-12-pro)
20
-    -   [Root Password Rules](#root-password-rules)
21
-    -   [Permitting Root Login with
22
-        SSH](#permitting-root-login-with-ssh)
23
-    -   [PXE Boot](#pxe-boot)
24
-    -   [Kickstart](#kickstart)
25
-    -   [Checking the Version and Build
26
-        Number](#checking-the-version-and-build-number)
27
--   [Tiny DNF for Package
28
-    Management](#tiny-dnf-for-package-management)
29
-    -   [Configuration Files and
30
-        Repositories](#configuration-files-and-repositories)
31
-    -   [Options for Commands](#options-for-commands)
32
-    -   [Commands](#commands)
33
-    -   [Adding a New Repository](#adding-a-new-repository)
34
-    -   [Adding the Dev Repository to Get New Packages from the
35
-        GitHub Dev
36
-        Branch](#adding-the-dev-repository-to-get-new-packages-from-the-github-dev-branch)
37
--   [Managing Services with
38
-    systemd](#managing-services-with-systemd)
39
-    -   [Using the Photon Management Daemon](#using-the-photon-management-daemon)
40
-    -   [Using the Network Configuration Manager](#using-the-network-configuration-manager)
41
-    -   [Viewing Services](#viewing-services)
42
-    -   [Controlling Services](#controlling-services)
43
-    -   [Creating a Startup Service](#creating-a-startup-service)
44
-    -   [Disabling the Photon OS
45
-        httpd.service](#disabling-the-photon-os-httpd.service)
46
-    -   [Auditing System Events with
47
-        auditd](#auditing-system-events-with-auditd)
48
-    -   [Analyzing systemd Logs with
49
-        journalctl](#analyzing-systemd-logs-with-journalctl)
50
-    -   [Migrating Scripts to
51
-        systemd](#migrating-scripts-to-systemd)
52
--   [Managing the Network
53
-    Configuration](#managing-the-network-configuration)
54
-    -   [Using the Photon Management Daemon](#using-the-photon-management-daemon)
55
-    -   [Using the Network Configuration Manager](#using-the-network-configuration-manager)
56
-    -   [Use `ip` and `ss` Commands Instead of `ifconfig` and
57
-        `netstat`](#use-ip-and-ss-commands-instead-of-ifconfig-and-netstat)
58
-    -   [Configuring Network
59
-        Interfaces](#configuring-network-interfaces)
60
-    -   [Setting a Static IP Address](#setting-a-static-ip-address)
61
-    -   [Turning Off DHCP](#turning-off-dhcp)
62
-    -   [Adding a DNS Server](#adding-a-dns-server)
63
-    -   [Setting Up Networking for Multiple
64
-        NICs](#setting-up-networking-for-multiple-nics)
65
-    -   [Combining DHCP and Static IP Addresses with IPv4 and
66
-        IPv6](#combining-dhcp-and-static-ip-addresses-with-ipv4-and-ipv6)
67
-    -   [Clearing the Machine ID of a Cloned Instance for
68
-        DHCP](#clearing-the-machine-id-of-a-cloned-instance-for-dhcp)
69
-    -   [Using Predictable Network Interface
70
-        Names](#using-predictable-network-interface-names)
71
-    -   [Inspecting the Status of Network Links with
72
-        `networkctl`](#inspecting-the-status-of-network-links-with-networkctl)
73
-    -   [Turning on Network
74
-        Debugging](#turning-on-network-debugging)
75
-    -   [Mounting a Network File
76
-        System](#mounting-a-network-file-system)
77
-    -   [Installing the Packages for tcpdump and netcat with
78
-        tdnf](#installing-the-packages-for-tcpdump-and-netcat-with-tdnf)
79
--   [Cloud-Init on Photon OS](#cloud-init-on-photon-os)
80
-    -   [Creating a Stand-Alone Photon Machine with
81
-        cloud-init](#creating-a-stand-alone-photon-machine-with-cloud-init)
82
-    -   [Customizing a Photon OS Machine on
83
-        EC2](#customizing-a-photon-os-machine-on-ec2)
84
-    -   [Running a Photon OS Machine on
85
-        GCE](#running-a-photon-os-machine-on-gce)
86
--   [Docker Containers](#docker-containers)
87
--   [Kubernetes](#kubernetes)
88
--   [Installing Sendmail](#installing-sendmail)
89
-    -   [Fixing Sendmail If Installed Before an FQDN Was
90
-        Set](#fixing-sendmail-if-installed-before-an-fqdn-was-set)
91
--   [Changing the Locale](#changing-the-locale)
92
--   [The Default Security Policy of Photon
93
-    OS](#the-default-security-policy-of-photon-os)
94
-    -   [Default Firewall Settings](#default-firewall-settings)
95
-    -   [Default Permissions and
96
-        umask](#default-permissions-and-umask)
97
--   [Disabling TLS 1.0 to Improve Transport Layer
98
-    Security](#disabling-tls-1.0-to-improve-transport-layer-security)
99
--   [Working with Repositories and
100
-    Packages](#working-with-repositories-and-packages)
101
-    -   [Photon OS Package
102
-        Repositories](#photon-os-package-repositories)
103
-    -   [Examining Signed Packages](#examining-signed-packages)
104
-    -   [Building a Package from a Source
105
-        RPM](#building-a-package-from-a-source-rpm)
106
-    -   [Compiling C++ Code on the Minimal Version of Photon
107
-        OS](#compiling-c-code-on-the-minimal-version-of-photon-os)
108
--   [References](#references)
109
-
110
-
111
-## Introduction
112
-
113
-This guide describes the fundamentals of administering Photon OS, the open-source minimalist Linux operating system from VMware that is optimized for cloud computing platforms, VMware vSphere deployments, and applications native to the cloud. 
114
-
115
-The guide covers the basics of managing packages, controlling services with systemd, setting up networking, initializing Photon OS with cloud-init, running Docker containers, and working with other technologies, such as Kubernetes. The guide also includes a section to get you started using Photon OS quickly and easily. 
116
-
117
-Photon OS is a Linux container host optimized for vSphere and cloud-computing platforms such as Amazon Elastic Compute and Google Compute Engine. As a lightweight and extensible operating system, Photon OS works with the most common container formats, including Docker, Rocket, and Garden. Photon OS includes a yum-compatible, package-based lifecycle management system called tdnf.
118
-
119
-When used with development tools and environments such as VMware Fusion, VMware Workstation, HashiCorp (Vagrant and Atlas), and production runtime environments (vSphere, vCloud Air), Photon OS lets you seamlessly migrate container-based applications from development to production. With a small footprint and fast boot and run times, Photon OS is optimized for cloud computing and cloud  applications.  
120
-
121
-There are two versions of Photon OS: a minimal version and a full version. 
122
-
123
-The minimal version of Photon OS is lightweight container host runtime environment best suited to managing and hosting containers. The minimal version contains just enough packaging and functionality to manage and modify containers while remaining a fast runtime environment. The minimal version is ready to work with appliances. 
124
-
125
-The full version of Photon OS includes additional packages to help you customize the system and create containerized applications. For  running containers, the full version is excessive. The full version is targeted at helping you create, develop, test, and package an application that runs a container. 
126
-
127
-Two characteristics of Photon OS stand out: It manages services with systemd and it manages packages with an open source, yum-compatible package manager called tdnf, for Tiny DNF. 
128
-
129
-By using systemd, Photon OS adopts a contemporary Linux standard to manage system services. Photon OS bootstraps the user space and concurrently starts services with systemd. The systemctl utility controls services on Photon OS. For example, instead of running the /etc/init.d/ssh script to stop and start the OpenSSH server on a init.d-based Linux system, you run the following systemctl commands on Photon OS: 
130
-
131
-	systemctl stop sshd
132
-	systemctl start sshd
133
-
134
-Tdnf keeps the operating system as small as possible while preserving yum's robust package-management capabilities. On Photon OS, tdnf is the default package manager for installing new packages. It is a C implementation of DNF package manager. 
135
-
136
-### Examining the Packages in the SPECS Directory on Github
137
-
138
-The SPECS directory of the GitHub website for Photon OS contains all the packages that can appear in Photon OS repositories:  
139
-
140
-https://github.com/vmware/photon/tree/master/SPECS
141
-
142
-To see the version of a package, in the SPECS directory, click the name of the subdirectory of the package that you want to examine, and then click the `.spec` filename in the subdirectory. For example, the version of OpenJDK, which contains the openjre package that installs the Java class library and the javac Java compiler, looks like this: 
143
-
144
-<pre>
145
-%define _use_internal_dependency_generator 0
146
-Summary:	OpenJDK 
147
-Name:		openjdk
148
-Version:	1.8.0.72
149
-Release:	1%{?dist}
150
-License:	GNU GPL
151
-URL:		https://openjdk.java.net
152
-Group:		Development/Tools
153
-Vendor:		VMware, Inc.
154
-Distribution:   Photon
155
-AutoReqProv: 	no
156
-Source0:	http://anduin.linuxfromscratch.org/files/BLFS/OpenJDK-%{version}/OpenJDK-%{version}-x86_64-bin.tar.xz
157
-%define sha1 OpenJDK=0c705d7b13f4e22611d2da654209f469a6297f26
158
-%description
159
-The OpenJDK package installs java class library and javac java compiler. 
160
-
161
-%package	-n openjre
162
-Summary:	Jave runtime environment
163
-AutoReqProv: 	no
164
-%description	-n openjre
165
-It contains the libraries files for Java runtime environment
166
-#%global __requires_exclude ^libgif.*$
167
-#%filter_from_requires ^libgif.*$...
168
-...
169
-</pre>
170
-
171
-### Looking at the Differences Between the Minimal and the Full Version
172
-
173
-The minimal version of Photon OS contains about 50 packages. As it is installed, the number of packages increases to nearly 100 to fulfill dependencies. The full version of Photon OS adds several hundred packages to those in the minimal version to deliver a more fully featured operating system. 
174
-
175
-You can view a list of the packages that appear in the minimal version by examining the following file: 
176
-
177
-[https://github.com/vmware/photon/blob/master/common/data/packages_minimal.json](https://github.com/vmware/photon/blob/master/common/data/packages_minimal.json)
178
-
179
-You can view a list of the packages that appear in the full version by examining the following file: 
180
-
181
-[https://github.com/vmware/photon/blob/master/common/data/packages_full.json](https://github.com/vmware/photon/blob/master/common/data/packages_full.json)
182
-
183
-If the minimal or the full version of Photon OS does not contain a package that you want, you can of course install it with tdnf, which appears in both the minimal and full versions of Photon OS by default. In the full version of Photon OS, you can also install packages by using yum. 
184
-
185
-One notable difference between the two versions of Photon OS pertains to OpenJDK, the package that contains not only the Java runtime environment (openjre) but also the Java compiler (javac). The OpenJDK package appears in the full but not the minimal version of Photon OS. To add support for Java programs to the minimal version of Photon OS, install the Java packages and their dependencies: 
186
-
187
-	tdnf install openjdk
188
-	Installing:
189
-	openjre 	x86_64    1.8.0.92-1.ph1    95.09 M
190
-	openjdk 	x86_64    1.8.0.92-1.ph1    37.63 M
191
-
192
-**NOTE:** openjdk and openjre are available as openjdk8 and openjre8 in Photon OS 2.0
193
-
194
-A later section covers tdnf. 
195
-
196
-### The Root Account and the `sudo` and `su` Commands
197
-
198
-This guide assumes that you are logged in to Photon OS with the root account and running commands as root. The sudo program comes with the full version of Photon OS. On the minimal version, you must install sudo with tdnf if you want to use it. As an alternative to installing sudo on the minimal version, you can switch users as needed with the `su` command to run commands that require root privileges. 
199
-
200
-## Getting Started with Photon OS 2.0
201
-
202
-**NOTE:** This section applies to Photon OS 2.0 only.
203
-
204
-To get started with Photon OS 2.0, refer to the installation instructions for your target environment:
205
-- [Running Photon OS on VMware vSphere](Running-Photon-OS-on-vSphere.md)
206
-- [Running Photon OS on VMware Fusion](Running-Project-Photon-on-Fusion.md)
207
-- [Running Photon OS on VMware Workstation](Running-Photon-OS-on-Workstation.md)
208
-- [Running Photon OS on Amazon EC2](Running-Photon-OS-on-Amazon-Elastic-Cloud-Compute.md)
209
-- [Running Photon OS on Google Compute Engine](Running-Photon-OS-on-Google-Compute-Engine.md)
210
-- [Running Photon OS on Microsoft Azure](Running-Photon-OS-on-Microsoft-Azure.md)
211
-
212
-**Note**: If you want to upgrade an existing Photon 1.0 VM, refer to the instructions in [Upgrading to Photon OS 2.0](Upgrading-to-Photon-OS-2.0.md). 
213
-
214
-## Quick Start for Photon OS 1.0
215
-
216
-**NOTE:** This section applies to Photon OS 1.0 only.
217
-
218
-This section helps you get Photon OS up and running quickly and easily. There are several ways to deploy Photon OS for free within a matter of minutes:
219
-
220
-* Obtain the ISO from Bintray and use it to create a virtual machine running Photon OS.
221
-* Install the OVA for the minimal version of Photon OS in VMware vSphere.
222
-* Rapidly deploy the OVA for the minimal version of Photon OS in VMware Workstation 12 Pro. 
223
-
224
-### Obtaining the ISO from Bintray and Creating a Photon OS VM in VMware Workstation
225
-
226
-The full version of Photon OS installs from an ISO in VMware Workstation and other hypervisors in a matter of minutes. Photon OS is a free download from the Bintray web site.
227
-
228
-This section demonstrates how to create a virtual machine running Photon OS in VMware Workstation 12 Pro. If you are using a different hypervisor, the example set by this section should help you install it in your system. For instructions on how to install Photon OS from an ISO in VMware vSphere, see [Installing Photon OS on VMware vSphere from an ISO Image](Running-Project-Photon-on-vSphere.md).
229
-
230
-1. Go to the following Bintray URL and download the ISO for the general availability release of Photon OS:
231
-
232
-	https://bintray.com/vmware/photon/iso/view
233
-
234
-1. In VMware Workstation, type Ctrl+N to create a new virtual machine. 
235
-
236
-1. In the New Virtual Machine Wizard, select `Typical`, and then click `Next`.
237
-
238
-1. Select `Installer disk image file (iso)`, click `Browse` to locate the Photon OS ISO that you downloaded from Bintray, and then click `Next`.
239
-
240
-1. For the guest operating system, select `Linux`. From the `Version` drop-down menu, select `VMware Photon 64-bit`. If you have an older version of VMware Workstation and Photon does not appear in the list, select `Other Linux 3.x kernel 64-bit`.
241
-![VMware Photon](images/ws-new-vm.png)
242
-
243
-1. Click `Next` through the remaining dialog boxes of the wizard,  either accepting the default settings, which is recommended, or making the changes that you want, and then click `Finish`.
244
-
245
-1. Power on the virtual machine and, in the Workstation window containing Photon, press Enter to start the installation.
246
-![Installer](images/photon-installer-sm.png)
247
-
248
-1. During disk setup, the installer might ask you to confirm that this will erase the disk. If so, accept the default value of `yes` by hitting your Enter key.
249
-
250
-1. Select the installation that you want. For this example, choose `Photon Full` by using the tab key to move to Photon Full and then hitting the space bar to select it. Press Enter to install it. 
251
-
252
-1. Either accept the default hostname that Photon provides or type the name that you want. Press Enter to continue. 
253
-
254
-1. Type the root password. Photon OS requires the root password to be a complex string containing no common words or names.
255
-
256
-The installation typically completes in about 150 seconds for the full version and in less than 30 seconds for the minimal version. After the installation finishes, boot the system and log in as root with your root password. 
257
-
258
-To connect to Photon OS by SSH, see the section on permitting root login with SSH below.  
259
-
260
-You can also build an ISO containing Photon OS from its source code on GitHub by following the instructions in the document on [building Photon OS](build-photon.md). 
261
-
262
-### Installing the OVA for the Minimal Version in vSphere
263
-
264
-You can download the OVA for the minimal version of Photon OS from Bintray and deploy it in vSphere in a matter of seconds. Here's how: 
265
-
266
-Download the OVA for the minimal version of Photon OS from the following URL: 
267
-
268
-	https://bintray.com/vmware/photon/ova
269
-
270
-To install the OVA in vSphere, on the `File` menu, click `Deploy OVF Template`, and then click `Browse` to locate the image that you downloaded. Move through the `Deploy OVF Template` dialog boxes by clicking `Next` to accept the default settings, and then click `Finish`. 
271
-
272
-In vSphere Client, turn on the power of the Photon OS virtual machine and open a console to it.
273
-
274
-The default password for the root account is `changeme`, and you must change it when you first login. For security, Photon OS forbids common dictionary words for the root password. 
275
-
276
-There are other options for installing Photon OS in vSphere, such as building an ISO from the source code. For more information about the versions of Photon and their installation options, see [Running Photon OS on vSphere](Running-Project-Photon-on-vSphere.md).
277
-
278
-### Rapidly Deploying the Photon OS OVA in VMware Workstation 12 Pro
279
-
280
-Here's how to rapidly deploy the OVA for Photon in VMware Workstation 12 Pro by using an up-to-date version of Firefox. The procedure in other browsers or another version of Workstation might be different. 
281
-
282
-In Firefox, download the OVA for the minimal version of Photon OS from this URL: 
283
-
284
-	https://bintray.com/vmware/photon/ova
285
-
286
-In the download dialog box, select `Open with VMware Workstation (default)`, like this:
287
-
288
-![Firefox Dialogue Box](images/ova-firefox.png)
289
-
290
-In the Workstation Import dialog box, click Import.
291
-
292
-![Import virtual machine](images/ova-import.png)
293
-
294
-Workstation creates a virtual machine from the Photon OS OVA template in a few seconds. In Workstation, power on the virtual machine and log in as root with the initial password of `changeme`.
295
-
296
-Photon OS then prompts you to change the root password.  
297
-	
298
-###	Root Password Rules
299
-
300
-When you first log on a new Photon OS machine, you must set the root password to a complex string containing no common words or names. Photon OS rejects a root password that contains simplistic patterns, common words, or words derived from the name of your account. The rules apply only to the root password, not other user and group accounts. 
301
-
302
-###	Permitting Root Login with SSH
303
-
304
-The full version of Photon OS prevents root login with SSH by default. To permit root login over SSH, open `/etc/ssh/sshd_config` with the vim text editor and set `PermitRootLogin` to `yes`. 
305
-
306
-Vim is the default text editor available in both the full and minimal versions of Photon OS. (Nano is also in the full version.) After you modify the SSH daemon's configuration file, you must restart the sshd daemon for the changes to take effect. Example: 
307
-
308
-	vim /etc/ssh/sshd_config
309
-
310
-	# override default of no subsystems
311
-	Subsystem       sftp    /usr/libexec/sftp-server
312
-
313
-	# Example of overriding settings on a per-user basis
314
-	#Match User anoncvs
315
-	#       X11Forwarding no
316
-	#       AllowTcpForwarding no
317
-	#       PermitTTY no
318
-	#       ForceCommand cvs server
319
-	PermitRootLogin yes
320
-	UsePAM yes
321
-
322
-Save your changes in vim and then restart the sshd daemon: 
323
-
324
-	systemctl restart sshd
325
-
326
-You can then connect to the Photon OS machine with the root account over SSH:
327
-
328
-	steve@ubuntu:~$ ssh root@198.51.100.131
329
-
330
-### PXE Boot
331
-
332
-Photon OS works with the Preboot Execution Environment, or PXE, to boot by retrieving software from a PXE server over a network connection. For instructions on how to set Photon OS to boot from a PXE server, see [Network PXE Boot](PXE-boot.md).
333
-
334
-### Kickstart
335
-
336
-Photon OS supports kickstart for unattended installations through a CD-ROM or an HTTP server. On Photon OS, kickstart can set the hostname, password, run post-installation scripts, and add public keys for SSH. See [Kickstart Support](kickstart.md).
337
-
338
-### Checking the Version and Build Number
339
-
340
-To check the version and build number of Photon OS, concatenate `/etc/photon-release`. Example: 
341
-
342
-	cat /etc/photon-release
343
-	VMware Photon Linux 1.0
344
-	PHOTON_BUILD_NUMBER=a6f0f63
345
-
346
-The build number in the results maps to the commit number on the VMware Photon OS GitHub [commits page](https://github.com/vmware/photon/commits/master).
347
-
348
-## Tiny DNF for Package Management
349
-
350
-On Photon OS, Tiny DNF, for [Tiny Dandified Yum](https://github.com/vmware/tdnf), is the default package manager for installing new packages. It is a C implementation of DNF package manager. The standard syntax for `tdnf` commands is the same as that for DNF: 
351
-
352
-	tdnf [options] <command> [<arguments>...]
353
-
354
-You can view its help information like this: 
355
-
356
-	tdnf --help
357
-	tdnf -h
358
-
359
-**Photon OS 1.0 only**: In the minimal version of Photon OS, tdnf serves as the sole package manager to streamline the operating system. The full version of Photon OS includes yum, a common utility that checks for, downloads, and automatically installs RPM packages. On the minimal version of Photon OS, you can install yum by using tdnf if you are unconcerned with the size of the operating system: ``tdnf install yum``
360
-
361
-### Configuration Files and Repositories
362
-
363
-The main configuration files reside in /etc/tdnf/tdnf.conf. The configuration file looks like this: 
364
-
365
-	cat /etc/tdnf/tdnf.conf
366
-	[main]
367
-	gpgcheck=1
368
-	installonly_limit=3
369
-	clean_requirements_on_remove=true
370
-	repodir=/etc/yum.repos.d
371
-	cachedir=/var/cache/tdnf
372
-
373
-The cache files for data and metadata reside in /var/cache/tdnf. 
374
-
375
-The repositories appear in /etc/yum.repos.d/ with `.repo` file extensions:
376
-
377
-	ls /etc/yum.repos.d/
378
-	lightwave.repo
379
-	photon-extras.repo
380
-	photon-iso.repo
381
-	photon-updates.repo
382
-	photon.repo 
383
-
384
-**Note:** Photon OS 1.0 (only) also includes the lightwave.repo.
385
-
386
-You can list the the repositories by using the `tdnf repolist` command. Tdnf filters the results with `enabled`, `disabled`, and `all`. Running the command without specifying an argument returns the enabled repositories:  
387
-
388
-	tdnf repolist
389
-	repo id             repo name                               status
390
-	photon-updates      VMware Photon Linux 2.0(x86_64)Updates  enabled
391
-	photon-extras       VMware Photon Extras 2.0(x86_64)        enabled
392
-	photon              VMware Photon Linux 2.0(x86_64)         enabled
393
-
394
-**Note:** Photon OS 1.0 (only) also includes the lightwave repository.
395
-
396
-The photon-iso.repo, however, does not appear in the list of repositories because it is unavailable on the virtual machine from which these examples are taken. Photon-iso.repo is the default repository; it points to /media/cdrom. The contents of photon-iso.repo look like this: 
397
-
398
-	cat /etc/yum.repos.d/photon-iso.repo
399
-	[photon-iso]
400
-	name=VMWare Photon Linux 2.0(x86_64)
401
-	baseurl=file:///mnt/cdrom/RPMS
402
-	gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
403
-	gpgcheck=1
404
-	enabled=0
405
-	skip_if_unavailable=True
406
-
407
-The local cache is populated with data from the repository: 
408
-
409
-	ls -l /var/cache/tdnf/photon
410
-	total 8
411
-	drwxr-xr-x 2 root root 4096 May 18 22:52 repodata
412
-	d-wxr----t 3 root root 4096 May  3 22:51 rpms
413
-
414
-You can clear the cache to help troubleshoot a problem, but keep in mind that doing so might slow the performance of tdnf until the cache becomes repopulated with data. Here is how to clear the cache: 
415
-
416
-	tdnf clean all
417
-	Cleaning repos: photon photon-extras photon-updates lightwave
418
-	Cleaning up everything
419
-
420
-The command purges the repository data from the cache: 
421
-
422
-	ls -l /var/cache/tdnf/photon
423
-	total 4
424
-	d-wxr----t 3 root root 4096 May  3 22:51 rpms
425
-
426
-### Options for Commands
427
-
428
-You can add the following options to `tdnf` commands. If the option to override a configuration is unavailable in a command, consider adding it to the configuration file, /etc/tdnf/tdnf.conf.
429
-
430
-	OPTION                     DESCRIPTION
431
-	--allowerasing             Allow erasing of installed packages to resolve dependencies
432
-	--assumeno                 Answer no for all questions
433
-	--best                     Try the best available package versions in transactions
434
-	--debugsolver              Dump data aiding in dependency solver debugging info.
435
-	--disablerepo=<repoid>     Disable specific repositories by an id or a glob.
436
-	--enablerepo=<repoid>      Enable specific repositories
437
-	-h, --help                 Display help
438
-	--refresh                  Set metadata as expired before running command
439
-	--nogpgcheck               Skip gpg check on packages
440
-	--rpmverbosity=<debug level name>
441
-	                           Debug level for rpm
442
-	--version                  Print version and exit
443
-	-y, --assumeyes            Answer yes to all questions
444
-	-q, --quiet                Quiet operation
445
-
446
-Here is an example that adds the short form of the `assumeyes` option to the install command:
447
-
448
-	tdnf -y install gcc
449
-	Upgrading:
450
-	gcc 	x86_64	5.3.0-1.ph1 	91.35 M
451
-
452
-
453
-### Commands
454
-
455
-**check**: Checks for problems in installed and available packages for all enabled repositories. Command has no arguments. You can use ``--enablerepo`` and ``--disablerepo`` to control the repos used. Supported in Photon OS 2.0 (only).
456
-
457
-**check-local**: This command resolves dependencies by using the local RPMs to help check RPMs for quality assurance before publishing them. To check RPMs with this command, you must create a local directory and place your RPMs in it. The command, which includes no options, takes the path to the local directory containing the RPMs as its argument. The command does not, however, recursively parse directories; it checks the RPMs only in the directory that you specify. For example, after creating a directory named `/tmp/myrpms` and placing your RPMs in it, you can run the following command to check them:  
458
-
459
-	tdnf check-local /tmp/myrpms
460
-	Checking all packages from: /tmp/myrpms
461
-	Found 10 packages
462
-	Check completed without issues
463
-
464
-**check-update**: This command checks for updates to packages. It takes no arguments. The `tdnf list updates` command performs the same function. Here is an example of the `check update` command: 
465
-
466
-	tdnf check-update
467
-	rpm-devel.x86_64 	4.11.2-8.ph1 	photon
468
-	yum.noarch      	3.4.3-3.ph1 	photon
469
-
470
-**clean**: This command cleans up temporary files, data, and metadata. It takes the argument `all`. Example: 
471
-
472
-	tdnf clean all
473
-	Cleaning repos: photon photon-extras photon-updates lightwave
474
-	Cleaning up everything
475
-
476
-**distro-sync**: This command synchronizes the machine's RPMs with the latest version of all the packages in the repository. Abridged example:
477
-
478
-	tdnf distro-sync
479
-
480
-	Upgrading:
481
-	zookeeper                             x86_64        3.4.8-2.ph1               3.38 M
482
-	yum                                   noarch        3.4.3-3.ph1               4.18 M
483
-
484
-	Total installed size: 113.01 M
485
-
486
-	Reinstalling:
487
-	zlib-devel                            x86_64        1.2.8-2.ph1             244.25 k
488
-	zlib                                  x86_64        1.2.8-2.ph1             103.93 k
489
-	yum-metadata-parser                   x86_64        1.1.4-1.ph1              57.10 k
490
-
491
-	Total installed size: 1.75 G
492
-
493
-	Obsoleting:
494
-	tftp                                  x86_64        5.2-3.ph1                32.99 k
495
-
496
-	Total installed size: 32.99 k
497
-	Is this ok [y/N]:
498
-
499
-**downgrade**: This command downgrades the package that you specify as an argument to the next lower package version. Example: 
500
-
501
-	tdnf downgrade boost
502
-	Downgrading:
503
-	boost                                 x86_64        1.56.0-2.ph1              8.20 M
504
-	Total installed size: 8.20 M
505
-	Is this ok [y/N]:y
506
-	Downloading:
507
-	boost                                  2591470    100%
508
-	Testing transaction
509
-	Running transaction
510
-	Complete!
511
-
512
-To downgrade to a version lower than the next one, you must specify it by name, epoch, version, and release, all properly hyphenated. Example: 
513
-
514
-	tdnf downgrade boost-1.56.0-2.ph1 
515
-
516
-**erase**: This command removes the package that you specify as an argument. Example: 
517
-
518
-	tdnf erase vim
519
-	Removing:
520
-	vim                                   x86_64        7.4-4.ph1                 1.94 M
521
-	Total installed size: 1.94 M
522
-	Is this ok [y/N]:
523
-
524
-You can also erase multiple packages: 
525
-
526
-	tdnf erase docker cloud-init
527
-
528
-**info**: This command displays information about packages. It can take the name of a package. Or it can take one of the following arguments: all, available, installed, extras, obsoletes, recent, upgrades. Examples: 
529
-
530
-	tdnf info ruby
531
-	tdnf info obsoletes
532
-	tdnf info upgrades
533
-
534
-**install**: This command takes the name of a package as its argument. It then installs the package and its dependencies. Examples: 
535
-
536
-	tdnf install kubernetes
537
-
538
-You can also install multiple packages: 
539
-
540
-	tdnf install python-curses lsof audit gettext chkconfig ntsysv bindutils 
541
-		 wget gawk irqbalance lvm2 cifs-utils c-ares distrib-compat
542
-	
543
-
544
-**list**: This command lists the packages of the package that you specify as the argument. The command can take one of the following arguments: all, available, installed, extras, obsoletes, recent, upgrades. 
545
-
546
-	tdnf list updates
547
-
548
-The list of packages might be long. To more easily view it, you can concatenate it into a text file, and then open the text file in a text editor: 
549
-
550
-	tdnf list all > pkgs.txt
551
-	vi pkgs.txt
552
-
553
-**makecache**: This command updates the cached binary metadata for all known repositories. Example:
554
-
555
-	tdnf makecache
556
-	Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
557
-	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
558
-	Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
559
-	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
560
-	Metadata cache created.
561
-
562
-**provides**: This command finds the packages that provide the package that you supply as an argument. Examples: 
563
-
564
-	tdnf provides docker
565
-	docker-1.11.0-1.ph1.x86_64 : Docker
566
-	Repo     : photon
567
-	docker-1.11.0-1.ph1.x86_64 : Docker
568
-	Repo     : @System
569
-
570
-**reinstall**: This command reinstalls the packages that you specify. If some packages are unavailable or not installed, the command fails. Example: 
571
-
572
-	tdnf reinstall docker kubernetes
573
-
574
-	Reinstalling:
575
-	kubernetes                            x86_64        1.1.8-1.ph1             152.95 M
576
-	docker                                x86_64        1.11.0-1.ph1             57.20 M
577
-
578
-	Total installed size: 210.15 M
579
-
580
-**remove**: This command removes a package. When removing a package, tdnf by default also removes dependencies that are no longer used if they were was installed by tdnf as a dependency without being explicitly requested by a user. You can modify the dependency removal by changing the `clean_requirements_on_remove` option in /etc/tdnf/tdnf.conf to `false`. 
581
-
582
-	tdnf remove packagename
583
-
584
-**search**: This command searches for the attributes of packages. The argument can be the names of packages, as this example testifies: 
585
-
586
-	tdnf search docker kubernetes
587
-	docker : Docker
588
-	docker : Docker
589
-	docker-debuginfo : Debug information for package docker
590
-	docker : Docker
591
-	kubernetes : Kubernetes cluster management
592
-	kubernetes : Kubernetes cluster management
593
-	kubernetes-debuginfo : Debug information for package kubernetes
594
-	kubernetes : Kubernetes cluster management
595
-
596
-The argument of the search command can also be a keyword or a combination of keywords and packages: 
597
-
598
-	tdnf search terminal bash
599
-	rubygem-terminal-table : Simple, feature rich ascii table generation library
600
-	ncurses : Libraries for terminal handling of character screens
601
-	mingetty : A minimal getty program for virtual terminals
602
-	ncurses : Libraries for terminal handling of character screens
603
-	ncurses : Libraries for terminal handling of character screens
604
-	bash : Bourne-Again SHell
605
-	bash-lang : Additional language files for bash
606
-	bash-lang : Additional language files for bash
607
-	bash : Bourne-Again SHell
608
-	bash-debuginfo : Debug information for package bash
609
-	bash : Bourne-Again SHell
610
-	bash-lang : Additional language files for bash
611
-
612
-**upgrade**: This command upgrades the package or packages that you specify to an available higher version that tdnf can resolve. If the package is already the latest version, the command returns `Nothing to do`. Example: 
613
-
614
-	tdnf upgrade boost
615
-
616
-	Upgrading:
617
-	boost                                 x86_64        1.60.0-1.ph1              8.11 M
618
-
619
-	Total installed size: 8.11 M
620
-	Is this ok [y/N]:y
621
-
622
-	Downloading:
623
-	boost                                  2785950    100%
624
-	Testing transaction
625
-	Running transaction
626
-
627
-	Complete!
628
-
629
-You can also run the `upgrade` command with the `refresh` option to update the cached metadata with the latest information from the repositories. The following example refreshes the metadata and then checks for a new version of tdnf but does not find one, so tdnf takes no action: 
630
-
631
-	tdnf upgrade tdnf --refresh
632
-	Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
633
-	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
634
-	Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
635
-	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
636
-	Nothing to do.
637
-
638
-**upgrade-to**: This command upgrades to the version of the package that you specify. Example:
639
-
640
-	tdnf upgrade-to ruby2.3
641
-
642
-The commands and options of tdnf are, at present, a subset of those of dnf. For more help with `tdnf` commands, see the [DNF documentation](https://media.readthedocs.org/pdf/dnf/latest/dnf.pdf).
643
-
644
-### Adding a New Repository
645
-
646
-With Photon OS, you can add a new repository from which tdnf installs packages. To do so, you create a repository configuration file with a `.repo` extension and place it in /etc/yum.repos.d. The repository can be on either the Internet or a local server containing your in-house applications. 
647
-
648
-Be careful if you add a repository that's on the Internet: Installing packages from untrusted or unverified sources might put the security, stability, or compatibility of your system at risk. It might also make your system harder to maintain.  
649
-
650
-On Photon OS, the existing repositories appear in /etc/yum.repos.d:
651
-
652
-	ls /etc/yum.repos.d/
653
-	lightwave.repo
654
-	photon-extras.repo
655
-	photon-iso.repo
656
-	photon-updates.repo
657
-	photon.repo 
658
-
659
-Looking at one of the `.repo` files reveals the format and information that a new repository configuration file should contain:
660
-
661
-	cat /etc/yum.repos.d/lightwave.repo
662
-	[lightwave]
663
-	name=VMware Lightwave 1.0(x86_64)
664
-	baseurl=https://dl.bintray.com/vmware/lightwave
665
-	gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
666
-	gpgcheck=1
667
-	enabled=1
668
-	skip_if_unavailable=True
669
-
670
-The minimal information needed to establish a repository is an ID and human-readable name of the repository and its base URL. The ID, which appears in square brackets, must be one word that is unique amoung the system's repositories; in the example above, it is `[lightwave]`.
671
-
672
-The `baseurl` is a URL for the repository's repodata directory. For a repository on a local server that can be accessed directly or mounted as a file system, the base URL can be a file referenced by `file://`. Example:  
673
-
674
-	baseurl=file:///server/repo/
675
-
676
-The `gpgcheck` setting specifies whether to check the GPG signature. The `gpgkey` setting furnishes the URL for the repository's ASCII-armored GPG key file. Tdnf uses the GPG key to verify a package if its key has not been imported into the RPM database.
677
-
678
-The `enabled` setting tells tdnf whether to poll the repository. If `enabled` is set to `1`, tdnf polls it; if it is set to `0`, tdnf ignores it. 
679
-
680
-The `skip_if_unavailable` setting instructs tdnf to continue running if the repository goes offline.
681
-
682
-Other options and variables can appear in the repository file. The variables that go with some of the options can reduce future changes to the repository configuration files. There are variables to replace the value of the version of the package and to replace the base architecture. For more information, see the man page for yum.conf on the full version of Photon OS: `man yum.conf`
683
-
684
-Here is an example of how to add a new repository for a local server that tdnf polls for packages:
685
-
686
-	cat > /etc/yum.repos.d/apps.repo << "EOF"
687
-	[localapps]
688
-	name=Local In-House Applications(x86_64)
689
-	baseurl=file:///appserver/apps
690
-	enabled=1
691
-	skip_if_unavailable=True
692
-	EOF
693
-
694
-Because this new repository resides on a local server, make sure the Photon OS machine can connect to it by, for instance, mounting it. 
695
-
696
-After establishing a new repository, you must run the following command to update the cached binary metadata for the repositories that tdnf polls. Example:
697
-
698
-	tdnf makecache
699
-	Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
700
-	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
701
-	Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
702
-	Refreshing metadata for: 'Local In-House Applications(x86_64)'
703
-	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
704
-	Metadata cache created.
705
-
706
-### Adding the Dev Repository to Get New Packages from the GitHub Dev Branch
707
-
708
-If you want to try out new packages or the latest versions of existing packages as they are merged into the dev branch of the Photon OS GitHub site, you can add the dev repository to your repository list. Here's how: 
709
-
710
-On your Photon OS machine, run the following command as root to create a repository configuration file named `photon-dev.repo`, place it in /etc/yum.repos.d, and concatenate the repository's information into the file: 
711
-
712
-    cat > /etc/yum.repos.d/photon-dev.repo << "EOF" 
713
-    [photon-dev]
714
-    name=VMware Photon Linux Dev(x86_64)
715
-    baseurl=https://dl.bintray.com/vmware/photon_dev_$basearch
716
-    gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
717
-    gpgcheck=1
718
-    enabled=1
719
-    skip_if_unavailable=True
720
-    EOF
721
-
722
-After establishing a new repository, you must run the following command to update the cached binary metadata for the repositories that tdnf polls:
723
-
724
-    tdnf makecache
725
-
726
-## Managing Services with systemd
727
-
728
-Photon OS manages services with systemd. By using systemd, Photon OS adopts a contemporary Linux standard to bootstrap the user space and concurrently start services--an architecture that differs from traditional Linux systems such as SUSE Linux Enterprise Server. 
729
-
730
-A traditional Linux system contains an initialization system called SysVinit. With SLES 11, for instance, SysVinit-style init programs control how the system starts up and shuts down. Init implements system runlevels. A SysVinit runlevel defines a state in which a  process or service runs. 
731
-
732
-In contrast to a SysVinit system, systemd defines no such runlevels. Instead, systemd uses a dependency tree of targets to determine which services to start when. Combined with the declarative nature of systemd commands, systemd targets reduce the amount of code needed to run a command, leaving you with code that is easier to maintain and probably faster to execute. For an overview of systemd, see [systemd System and Service Manager](https://www.freedesktop.org/wiki/Software/systemd/) and the [man page for systemd](https://www.freedesktop.org/software/systemd/man/systemd.html).
733
-
734
-On Photon OS, you should manage services with systemd and its command-line utility for inspecting and controlling the system, `systemctl`, not the deprecated commands of init.d. 
735
-
736
-The following sections present a brief overview of useful systemctl commands and options for examining and managing the state of systemd services. For more information, see the index of all the systemd man pages, including systemctl, at the following URL: 
737
-
738
-[https://www.freedesktop.org/software/systemd/man/](https://www.freedesktop.org/software/systemd/man/)
739
-
740
-### Viewing Services 
741
-
742
-To view a description of all the active, loaded units, execute the systemctl command without any options or arguments: 
743
-
744
-	systemctl
745
-
746
-To see all the loaded, active, and inactive units and their description, run this command: 
747
-
748
-	systemctl --all
749
-
750
-To see all the unit files and their current status but no description, run this command: 
751
-
752
-	systemctl list-unit-files
753
-
754
-The `grep` command filters the services by a search term, a helpful tactic to recall the exact name of a unit file without looking through a long list of names. Example: 
755
-
756
-	systemctl list-unit-files | grep network
757
-	org.freedesktop.network1.busname           static
758
-	dbus-org.freedesktop.network1.service      enabled
759
-	systemd-networkd-wait-online.service       enabled
760
-	systemd-networkd.service                   enabled
761
-	systemd-networkd.socket                    enabled
762
-	network-online.target                      static
763
-	network-pre.target                         static
764
-	network.target                             static
765
-
766
-### Controlling Services
767
-
768
-To control services on Photon OS, you use systemctl. For example, instead of running the /etc/init.d/ssh script to stop and start the OpenSSH server on a init.d-based Linux system, you run the following systemctl commands on Photon OS: 
769
-
770
-	systemctl stop sshd
771
-	systemctl start sshd
772
-
773
-The systemctl tool includes a range of commands and options for inspecting and controlling the state of systemd and the service manager; for more information, see the [systemctl man page](https://www.freedesktop.org/software/systemd/man/systemctl.html).
774
-
775
-### Creating a Startup Service
776
-
777
-This section shows you how to create a systemd startup service that changes the maximum transmission unit, or MTU, of the default Ethernet connection, eth0.
778
-
779
-First, concatenate the following block of code into a file: 
780
-	
781
-	cat << EOF >> /lib/systemd/system/eth0.service
782
-	[Unit]
783
-	Description=Network interface initialization
784
-	After=local-fs.target network-online.target network.target
785
-	Wants=local-fs.target network-online.target network.target
786
-
787
-	[Service]
788
-	ExecStart=/bin/ifconfig eth0 mtu 1460 up
789
-	Type=oneshot
790
-
791
-	[Install]
792
-	WantedBy=multi-user.target
793
-	EOF
794
-
795
-Second, set the service to auto-start when the system boots: 
796
-
797
-	cd /lib/systemd/system/multi-user.target.wants/
798
-	ln -s ../eth0.service eth0.service
799
-
800
-### Disabling the Photon OS httpd.service 
801
-
802
-If your application or appliance includes its own HTTP server, you should turn off and disable the HTTP server that comes with Photon OS so that it does not conflict with your own HTTP server. 
803
-
804
-To stop it and disable it, run the following commands as root: 
805
-
806
-	systemctl stop httpd.service
807
-	systemctl disable httpd.service
808
-
809
-### Auditing System Events with auditd
810
-
811
-Because Photon OS emphasizes security, the Linux auditing service, auditd, is enabled and active by default on the full version of Photon OS: 
812
-
813
-	systemctl status auditd
814
-	* auditd.service - Security Auditing Service
815
-	   Loaded: loaded (/usr/lib/systemd/system/auditd.service; enabled; vendor preset: enabled)
816
-	   Active: active (running) since Fri 2016-04-29 15:08:50 UTC; 1 months 9 days ago
817
-	 Main PID: 250 (auditd)
818
-	   CGroup: /system.slice/auditd.service
819
-	           `-250 /sbin/auditd -n
820
-
821
-To help improve security, the auditd service can monitor file changes, system calls, executed commands, authentication events, and network access. After you implement an audit rule to monitor an event, the `aureport` tool generates reports to display information about the events. 
822
-
823
-You can, for instance, use the auditctl utility to set a rule that monitors the sudoers file for changes:
824
-
825
-	auditctl -w /etc/sudoers -p wa -k sudoers_changes
826
-
827
-This rule specifies that the auditd service watch (`-w`) the /etc/sudoers file to log permissions changes (`p`) to the write access (`w`) or attributes (`a`) of the file and to identify them in logs as `sudoers_changes`. The auditing logs appear in /var/log/audit/audit.log. You can list the auditing rules like this: 
828
-
829
-	auditctl -l
830
-	-w /etc/sudoers -p wa -k sudoers_changes
831
-
832
-For more information on the Linux Audit Daemon, see its man page on Photon OS: 
833
-
834
-	man auditd
835
-
836
-For more information on setting auditing rules and options with auditctl, see its man page:
837
-
838
-	man auditctl
839
-
840
-For more information on viewing reports on audited events, see the aureport man page:
841
-
842
-	man aureport
843
-
844
-### Analyzing systemd Logs with journalctl
845
-
846
-The journalctl tool queries the contents of the systemd journal. For help troubleshooting systemd, two journalctl queries are particularly useful: showing the log entries for the last boot and showing the log entries for a systemd service unit. 
847
-
848
-This command displays the messages that systemd generated during the last time the machine started: 
849
-
850
-	journalctl -b
851
-
852
-This command reveals the messages for only the systemd service unit specified by the `-u` option, which is auditd in the following example: 
853
-
854
-	journalctl -u auditd
855
-
856
-For more information, see the journalctl man page by running this command on Photon OS: `man journalctl`
857
-
858
-### Migrating Scripts to systemd
859
-
860
-Although systemd maintains compatibility with init.d scripts, you should, as a best practice, adapt the scripts that you want to run on Photon OS to systemd to avoid potential problems. Such a conversion standardizes the scripts, reduces the footprint of your code, makes the scripts easier to read and maintain, and improves their robustness on a systemd system.
861
-
862
-## Managing the Network Configuration
863
-
864
-The network service, which is enabled by default, starts when the system boots. You manage the network service by using systemd commands, such as systemd-networkd, systemd-resolvd, and networkctl. You can check its status of the network service by running the following command: 
865
-
866
-	systemctl status systemd-networkd
867
-
868
-Here is a healthy result of the command: 
869
-
870
-	* systemd-networkd.service - Network Service
871
-	   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
872
-	   Active: active (running) since Fri 2016-04-29 15:08:51 UTC; 6 days ago
873
-	     Docs: man:systemd-networkd.service(8)
874
-	 Main PID: 291 (systemd-network)
875
-	   Status: "Processing requests..."
876
-	   CGroup: /system.slice/systemd-networkd.service
877
-	           `-291 /lib/systemd/systemd-networkd
878
-
879
-Because Photon OS relies on systemd to manage services, you should employ the systemd suite of commands, not deprecated init.d commands or other deprecated commands, to manage networking. 
880
-
881
-### Using the Photon Management Daemon
882
-
883
-The Photon Management Daemon (PMD) that ships with Photon OS 2.0 provides the remote management of a Photon instance via several APIs: a command line client (pmd-cli), a REST API, and a Python API. The PMD provides the ability to manage network interfaces, packages, firewalls, users, and user groups.
884
-
885
-#### Installing the pmd Package
886
-
887
-The pmd package is included with your Photon OS 2.0 distribution. To make sure that you have the latest version, you can run:
888
-~~~~
889
-# tdnf install pmd
890
-# systemctl start pmd
891
-~~~~
892
-#### Available APIs
893
-
894
-##### pmd-cli
895
-
896
-The pmd-cli utility enables Photon customers to invoke API requests securely on local and remote servers. For details, see [Photon Management Daemon Command-line Interface (pmd-cli)](pmd-cli.md).
897
-
898
-##### PMD REST API
899
-
900
-The PMD REST API is an openapi 2.0 specification. Once the pmd package is installed, you can use a Swagger UI tool to browse the REST API specifications (/etc/pmd/restapispec.json).
901
-You can also browse it using the copenapi_cli tool that comes with the pmd package:
902
-~~~~
903
-# copenapi_cli --apispec /etc/pmd/restapispec.json
904
-~~~~
905
-For more information about the copenapi_cli tool, refer to [github.com/vmware/copenapi](https://github.com/vmware/copenapi).
906
-
907
-##### PMD Python API
908
-
909
-Python3 is included with your Photon OS 2.0 distribution. PMD Python interfaces are available for python3 (pmd-python3) and python2 (pmd-python2). You can use tdnf to ensure that the latest version is installed:
910
-~~~~
911
-# tdnf install pmd-python3
912
-# systemctl start pmd
913
-~~~~
914
-To navigate the help documentation for the pmd Python packages:
915
-~~~~
916
-# python3
917
->>> import pmd
918
->>> net = pmd.server().net
919
->>> help(pmd)
920
-~~~~
921
-To show help text for individual interfaces:
922
-~~~~
923
->>> help(pmd.server().net)
924
->>> help(pmd.server().pkg)
925
->>> help(pmd.server().firewall)
926
->>> help(pmd.server().user)
927
-~~~~
928
-For details about the network commands, see also the [Network Configuration Manager - Python API](netmgr.python.md).
929
-
930
-##### PMD C Documentation
931
-
932
-PMD C APIs are defined in the header files (pmd_fwmgmt.h, pmd_netmgr.h, pmd_pkgmgmt.h, pmd_usermgmt.h) that are stored in the following location:  
933
-~~~~
934
-[https://github.com/vmware/pmd/tree/master/include](https://github.com/vmware/pmd/tree/master/include)
935
-~~~~
936
-For details about the network commands, see also the [Network Configuration Manager - C API](netmgr.c.md).
937
-
938
-### Using the Network Configuration Manager
939
-
940
-The Network Configuration Manager library that ships with Photon OS 2.0 provides a collection of C, Python, and CLI APIs that simplify common onfiguration tasks for:
941
-- interfaces
942
-- IP addresses (IPv4 and IPv6 addresses)
943
-- routes
944
-- DNS server and domain settings
945
-- DHCP DUID and IAID settings
946
-- NTP server settings
947
-- service management
948
-- object parameters (interfaces and files)
949
-
950
-For additional details, see:
951
-- **CLI** - see the ``-net`` commands in the [Photon Management Daemon Command-line Interface (pmd-cli)](pmd-cli.md)
952
-- **C APIs** - [Network Configuration Manager - C API](netmgr.c.md)
953
-- **Python APIs** - [Network Configuration Manager - Python API](netmgr.python.md)
954
-
955
-### Use `ip` and `ss` Commands Instead of `ifconfig` and `netstat`
956
-
957
-Although the `ifconfig` command and the `netstat` command work on Photon OS, VMware recommends that you use the `ip` or `ss` commands. The `ipconfig` and `netstat` commands are deprecated. 
958
-
959
-For example, instead of running `netstat` to display a list of network interfaces, run the `ss` command. Similarly, to display information for IP addresses, instead of running `ifconfig -a`, run the `ip addr` command. Examples:
960
-
961
-	USE THIS IPROUTE COMMAND 	INSTEAD OF THIS NET-TOOL COMMAND
962
-	ip addr 					ifconfig -a
963
-	ss 							netstat
964
-	ip route 					route
965
-	ip maddr 					netstat -g
966
-	ip link set eth0 up 		ifconfig eth0 up
967
-	ip -s neigh					arp -v
968
-	ip link set eth0 mtu 9000	ifconfig eth0 mtu 9000
969
-
970
-Using the `ip route` version of a command instead of the net-tools version often provides more complete, accurate information on Photon OS, as the following example demonstrates: 
971
-
972
-	ip neigh
973
-	198.51.100.2 dev eth0 lladdr 00:50:56:e2:02:0f STALE
974
-	198.51.100.254 dev eth0 lladdr 00:50:56:e7:13:d9 STALE
975
-	198.51.100.1 dev eth0 lladdr 00:50:56:c0:00:08 DELAY
976
-
977
-	arp -a
978
-	? (198.51.100.2) at 00:50:56:e2:02:0f [ether] on eth0
979
-	? (198.51.100.254) at 00:50:56:e7:13:d9 [ether] on eth0
980
-	? (198.51.100.1) at 00:50:56:c0:00:08 [ether] on eth0
981
-
982
-### Configuring Network Interfaces
983
-
984
-Network configuration files for systemd-networkd reside in /etc/systemd/network and /usr/lib/systemd/network. Example:
985
-
986
-	root@photon-rc [ ~ ]# ls /etc/systemd/network/
987
-	99-dhcp-en.network
988
-
989
-By default, when Photon OS starts, it creates a DHCP network configuration file, or rule, which appears in /etc/systemd/network, the highest priority directory for network configuration files with the lowest priority filename:
990
-
991
-	cat /etc/systemd/network/99-dhcp-en.network
992
-	[Match]
993
-	Name=e*
994
-
995
-	[Network]
996
-	DHCP=yes
997
-
998
-Network configuration files can also appear in the system network directory, /usr/lib/systemd/network, as the results of the following search illustrate:
999
-
1000
-	root@photon-rc [ ~ ]# updatedb
1001
-	root@photon-rc [ ~ ]# locate systemd/network
1002
-	/etc/systemd/network
1003
-	/etc/systemd/network/99-dhcp-en.network
1004
-	/usr/lib/systemd/network
1005
-	/usr/lib/systemd/network/80-container-host0.network
1006
-	/usr/lib/systemd/network/80-container-ve.network
1007
-	/usr/lib/systemd/network/99-default.link
1008
-	root@photon-rc [ ~ ]#
1009
-
1010
-As you can see, the /usr/lib/systemd/network directory contains several network configuration files. Photon OS applies the configuration files in the [lexicographical order](https://en.wikipedia.org/wiki/Lexicographical_order) specified by the file names without regard for the network configuration directory in which the file resides unless the file name is the same. Photon OS processes files with identical names by giving precedence to files in the /etc directory over the other directory. Thus, the settings in /etc/systemd/network override those in /usr/lib/systemd/network. Once Photon OS matches an interface in a file, Photon OS ignores the interface if it appears in files processed later in the lexicographical order. 
1011
-
1012
-Each .network file contains a matching rule and a configuration that Photon OS applies when a device matches the rule. You set the matching rule and the configuration as sections containing vertical sets of key-value pairs according to the information at https://www.freedesktop.org/software/systemd/man/systemd.network.html. 
1013
-
1014
-To configure Photon OS to handle a networking use case, such as setting a static IP address or adding a name server, you create a configuration file with a `.network` extension and place it in the /etc/systemd/network directory.
1015
-
1016
-After you create a network configuration file with a `.network` extension, you must run the `chmod` command to set the new file's mode bits to `644`. Example: 
1017
-
1018
-    chmod 644 10-static-en.network
1019
-
1020
-For Photon OS to apply the new configuration, you must restart the `systemd-networkd` service by running the following command: 
1021
-
1022
-	systemctl restart systemd-networkd
1023
-
1024
-For information about network configuration files, their processing order, and their matching rules, sections, and keys, see https://www.freedesktop.org/software/systemd/man/systemd.network.html.
1025
-
1026
-For information about creating virtual network device files (`.netdev`), see https://www.freedesktop.org/software/systemd/man/systemd.netdev.html.
1027
-
1028
-### Setting a Static IP Address
1029
-
1030
-Before you set a static IP address, obtain the name of your Ethernet link by running the following command: 
1031
-
1032
-	networkctl
1033
-	IDX LINK             TYPE               OPERATIONAL SETUP
1034
-	  1 lo               loopback           carrier     unmanaged
1035
-	  2 eth0             ether              routable    configured
1036
-
1037
-In the results of the command, you can see the name of an Ethernet link, `eth0`.
1038
-
1039
-To create a network configuration file that systemd-networkd uses to establish a static IP address for the eth0 network interface, execute the following command as root: 
1040
-
1041
-	cat > /etc/systemd/network/10-static-en.network << "EOF"
1042
-
1043
-	[Match]
1044
-	Name=eth0
1045
-
1046
-	[Network]
1047
-	Address=198.51.0.2/24
1048
-	Gateway=198.51.0.1
1049
-	EOF
1050
-
1051
-Change the new file's mode bits by running the `chmod` command:
1052
-
1053
-    chmod 644 10-static-en.network
1054
-
1055
-Apply the configuration by running the following command:
1056
-
1057
-	systemctl restart systemd-networkd
1058
-
1059
-For more information, see the man page for systemd-networkd: `man systemd.network`
1060
-
1061
-### Turning Off DHCP
1062
-
1063
-By default, when Photon OS first starts, it creates a DHCP network configuration file, or rule, which appears in /etc/systemd/network, the highest priority directory for network configuration files with the lowest priority filename:
1064
-	cat /etc/systemd/network/99-dhcp-en.network
1065
-	[Match]
1066
-	Name=e*
1067
-
1068
-	[Network]
1069
-	DHCP=yes
1070
-
1071
-To turn off DHCP for all Ethernet interfaces, change the value of `DHCP` from `yes` to `no`, save the changes, and then restart the `systemd-networkd` service: 
1072
-
1073
-	systemctl restart systemd-networkd
1074
-
1075
-If you create a configuration file with a higher priority filename (e.g. `10-static-en.network`), it is not necessary but still recommended to turn off DHCP.
1076
-
1077
-### Adding a DNS Server 
1078
-
1079
-Photon OS resolves domain names, IP addresses, and network names for local applications by using systemd-resolved. The systemd-resolved daemon automatically creates and maintains the /etc/resolv.conf file, into which systemd-resolved places the IP address of the DNS server. You should therefore never modify the /etc/resolv.conf file.
1080
-
1081
-(If you want to implement a local resolver like bind instead of systemd-resolved, stop the systemd-resolved service and disable it.)
1082
-
1083
-If you open the default /etc/resolv.conf file after you deploy Photon OS, it looks like this: 
1084
-
1085
-	root@photon-rc [ ~ ]# cat /etc/resolv.conf
1086
-	# This file is managed by systemd-resolved(8). Do not edit.
1087
-	#
1088
-	# Third party programs must not access this file directly, but
1089
-	# only through the symlink at /etc/resolv.conf. To manage
1090
-	# resolv.conf(5) in a different way, replace the symlink by a
1091
-	# static file or a different symlink.
1092
-
1093
-	nameserver 198.51.100.2
1094
-
1095
-To add a DNS server to your static network configuration file, insert a DNS key into the Network section of, in this example, /etc/systemd/network/10-eth0-static.network and set it to the IP address of your DNS server: 
1096
-
1097
-	[Match]
1098
-	Name=e*
1099
-
1100
-	[Network]
1101
-	Address=198.51.0.2/24
1102
-	Gateway=198.51.0.1
1103
-	DNS=198.51.0.1
1104
-
1105
-Another way of adding a DNS server is to modify /etc/systemd/resolved.conf--a method that can be particularly useful when your machine is working with DHCP. For more information, see https://www.freedesktop.org/software/systemd/man/resolved.conf.html.
1106
-
1107
-You can optionally activate the local DNS stub resolver of systemd-resolved by adding `dns` and `resolve` to /etc/nsswitch.conf. To do so, make a backup copy of /etc/nsswitch.conf and then execute the following command as root:
1108
-
1109
-	sed -i 's/^hosts.*$/hosts: files resolve dns/' /etc/nsswitch.conf
1110
-
1111
-For more information on the systemd-resolved service, see https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html.
1112
-
1113
-
1114
-### Setting Up Networking for Multiple NICs
1115
-
1116
-If your machine contains multiple NICs, you should, as a best practice, create a .network configuration file for each network interface. The following scenario demonstrates how to set one wired network interface to use a static IP address and another wired network interface to use a dynamic IP address obtained through DHCP. Keep in mind that the following configurations are examples: You must change the IP addresses and other information to match your network and requirements.  
1117
-
1118
-First, create the .network file for the static Ethernet connection in /etc/systemd/network. A best practice is to match the exact name of the network interface, which is in this example eth0. This example file also includes a DNS server for the static IP address. As a result, the configuration sets the UseDNS key to false in the DHCP column so that Photon OS ignores the DHCP server for DNS for this interface.  
1119
-
1120
-	cat > /etc/systemd/network/10-eth0-static-en.network << "EOF"
1121
-	[Match]
1122
-	Name=eth0
1123
-
1124
-	[Network]
1125
-	Address=10.137.20.11/19
1126
-	Gateway=10.137.23.253
1127
-	DNS=10.132.71.1
1128
-
1129
-	[DHCP]
1130
-	UseDNS=false
1131
-	EOF
1132
-
1133
-Second, create the .network file for the second network interface, which is named eth1 in this example. This configuration file sets the eth1 interface to an IP address from DHCP and sets DHCP as the source for DNS lookups. Setting the DHCP key to `yes` acquires an IP address for IPv4 and IPv6. To acquire an IP address for IPv4 only, set the DHCP key to <code>ipv4</code>.
1134
-
1135
-	cat > /etc/systemd/network/50-eth1-dhcp-en.network << "EOF"
1136
-
1137
-	[Match]
1138
-	Name=eth1
1139
-
1140
-	[Network]
1141
-	DHCP=yes  
1142
-
1143
-	[DHCP]
1144
-	UseDNS=true
1145
-	EOF
1146
-
1147
-### Combining DHCP and Static IP Addresses with IPv4 and IPv6 
1148
-
1149
-This section presents examples that demonstrate how to combine DHCP and static IP addresses with both IPv4 and IPv6. 
1150
-
1151
-Here's how to use DHCP to allocate both IPv4 and IPv6 addresses:
1152
-
1153
-	[Network]
1154
-	DHCP=yes
1155
-
1156
-Here's how to use DHCP to allocate only IPv4 addresses:
1157
-
1158
-	[Network]
1159
-	DHCP=ipv4
1160
-
1161
-Here's how to use DHCP to allocate only IPv6 addresses:
1162
-
1163
-	[Network]
1164
-	DHCP=ipv6
1165
-
1166
-Here's how to use DHCP for IPv4 addresses and static IP addresses for IPv6 addresses: 
1167
-
1168
-	[Network]
1169
-	DHCP=ipv4
1170
-	Address=fd00::1/48
1171
-	Gateway=fd00::252
1172
-
1173
-Here's how to use DHCP for IPv6 addresses and static IP addresses for IPv4: 
1174
-
1175
-	[Network]
1176
-	DHCP=ipv6
1177
-	Address=10.10.10.1/24
1178
-	Gateway=10.10.10.253
1179
-
1180
-Here's how to use static IP addresses for both IPv4 and IPv6: 
1181
-
1182
-	[Network]
1183
-	DHCP=ipv6
1184
-	Address=10.10.10.1/24
1185
-	Gateway=10.10.10.253
1186
-	Address=fd00::1/48
1187
-	Gateway=fd00::252
1188
-
1189
-### Clearing the Machine ID of a Cloned Instance for DHCP
1190
-
1191
-Photon OS uses the contents of `/etc/machine-id` to determine the DHCP unique identifier (duid) that is used for DHCP requests. If you use a Photon OS instance as the base system for cloning to create additional Photon OS instances, you should clear the machine-id with this command: 
1192
-
1193
-    echo -n > /etc/machine-id
1194
-
1195
-With the value cleared, systemd regenerates the machine-id and, as a result, all DHCP requests will contain a unique duid. 
1196
-
1197
-### Using Predictable Network Interface Names
1198
-
1199
-On a virtual machine running Photon OS, just as on a bare-metal machine, the Ethernet network interface name might shift from one device to another if you add or removed a card and reboot the machine. A device named `eth2`, for example, might become `eth1` after a NIC is removed and the machine is restarted.
1200
-
1201
-You can prevent interface names from reordering by turning on [predictable network interface names](https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/). The naming schemes that Photon OS uses can then assign fixed, predictable names to network interfaces even after cards or other firmware are added or removed and the system is restarted. With predictable network interface names enabled, you can select among several options to assign persistent names to network interfaces:
1202
-
1203
-* Apply the `slot` name policy to set the name of networking devices in the `ens` format with a statically assigned PCI slot number.
1204
-* Apply the `mac` name policy to set the name of networking devices in the `enx` format a unique MAC address. 
1205
-* Apply the `path` name policy to set the name of networking devices in the `enpXsY` format derived from a device connector's physical location.
1206
-
1207
-(Although Photon OS also supports the `onboard` name policy to set in the `eno` format the name of networking devices from index numbers given by the firmware, the `onboard` policy might result in nonpersistent names.) 
1208
-
1209
-The option that you choose depends on your use case and your unique networking requirements. If, for instance, you clone clones virtual machines in a use case that requires the MAC addresses to be different from one another but the interface name to be the same, you should consider using `ens` to keep the slot the same after reboots. 
1210
-
1211
-Alternatively, if the cloning function supports it and it works for your use case, you can use `enx` to set a MAC address, which also persists after reboots. 
1212
-
1213
-Here's how to turn on predictable network interface names.
1214
-
1215
-First, make a backup copy of the following file in case you need to restore it later: 
1216
-
1217
-    cp /boot/grub/grub.cfg /boot/grub/grub.cfg.original
1218
-
1219
-Second, to turn on predictable network interface names, edit `/boot/grub/grub.cfg` to remove the following string: 
1220
-
1221
-    net.ifnames=0
1222
-
1223
-The string appears near the bottom of the file in the `menuentry` section:
1224
-
1225
-    menuentry "Photon" {
1226
-        linux "/boot/"$photon_linux root=$rootpartition net.ifnames=0 $photon_cmdline
1227
-        if [ "$photon_initrd" ]; then
1228
-            initrd "/boot/"$photon_initrd
1229
-        fi
1230
-    }
1231
-    # End /boot/grub2/grub.cfg
1232
-
1233
-Edit out `net.ifnames=0`, but make no other changes to the file, and then save it. 
1234
-
1235
-Third, specify the types of policies that you want to use for predictable interface names by modifying the `NamePolicy` option in `/lib/systemd/network/99-default.link`. Here's what the file looks like: 
1236
-
1237
-    cat /lib/systemd/network/99-default.link
1238
-    [Link]
1239
-    NamePolicy=kernel database
1240
-    MACAddressPolicy=persistent
1241
-
1242
-To use the `ens` or `enx` option, the `slot` policy or the `mac` policy can be added to the space-separated list of policies that follow the `NamePolicy` option in the default link file, `/lib/systemd/network/99-default.link`. The order of the policies matters: Photon OS applies the policy listed first before proceeding to the next policy if the first one fails. Example: 
1243
-
1244
-    /lib/systemd/network/99-default.link
1245
-    [Link]
1246
-    NamePolicy=slot mac kernel database
1247
-    MACAddressPolicy=persistent
1248
-
1249
-With the name policy specified in the above example, it's possible that you could still end up with an Ethernet-style interface name if the two previous policies, `slot` and `mac`, fail. 
1250
-
1251
-For information on setting name policies, see [systemd.link--network device configuration](https://www.freedesktop.org/software/systemd/man/systemd.link.html). 
1252
-
1253
-### Inspecting the Status of Network Links with `networkctl`
1254
-
1255
-The `networkctl` command shows information about network connections that helps you configure networking services and troubleshoot networking problems. You can, for example, progressively add options and arguments to the `networkctl` command to move from general information about network connections to specific information about a network connection. 
1256
-
1257
-Running `networkctl` without options defaults to the list command:  
1258
-
1259
-	networkctl
1260
-	IDX LINK             TYPE               OPERATIONAL SETUP
1261
-	  1 lo               loopback           carrier     unmanaged
1262
-	  2 eth0             ether              routable    configured
1263
-	  3 docker0          ether              routable    unmanaged
1264
-	 11 vethb0aa7a6      ether              degraded    unmanaged
1265
-	 4 links listed.
1266
-
1267
-Running `networkctl` with the status command displays information that looks like this; you can see that there are active network links with IP addresses for not only the Ethernet connection but also a Docker container. 
1268
-
1269
-	root@photon-rc [ ~ ]# networkctl status
1270
-	*      State: routable
1271
-	     Address: 198.51.100.131 on eth0
1272
-	              172.17.0.1 on docker0
1273
-	              fe80::20c:29ff:fe55:3ca6 on eth0
1274
-	              fe80::42:f0ff:fef7:bd81 on docker0
1275
-	              fe80::4c84:caff:fe76:a23f on vethb0aa7a6
1276
-	     Gateway: 198.51.100.2 on eth0
1277
-	         DNS: 198.51.100.2
1278
-
1279
-You can then add a network link, such as the Ethernet connection, as the argument of the status command to show specific information about the link: 
1280
-
1281
-	root@photon-rc [ ~ ]# networkctl status eth0
1282
-	* 2: eth0
1283
-	       Link File: /usr/lib/systemd/network/99-default.link
1284
-	    Network File: /etc/systemd/network/99-dhcp-en.network
1285
-	            Type: ether
1286
-	           State: routable (configured)
1287
-	            Path: pci-0000:02:01.0
1288
-	          Driver: e1000
1289
-	      HW Address: 00:0c:29:55:3c:a6 (VMware, Inc.)
1290
-	             MTU: 1500
1291
-	         Address: 198.51.100.131
1292
-	                  fe80::20c:29ff:fe55:3ca6
1293
-	         Gateway: 198.51.100.2
1294
-	             DNS: 198.51.100.2
1295
-	        CLIENTID: ffb6220feb00020000ab116724f520a0a77337
1296
-
1297
-And you can do the same thing with the Docker container: 
1298
-
1299
-	networkctl status docker0
1300
-	* 3: docker0
1301
-	       Link File: /usr/lib/systemd/network/99-default.link
1302
-	    Network File: n/a
1303
-	            Type: ether
1304
-	           State: routable (unmanaged)
1305
-	          Driver: bridge
1306
-	      HW Address: 02:42:f0:f7:bd:81
1307
-	             MTU: 1500
1308
-	         Address: 172.17.0.1
1309
-	                  fe80::42:f0ff:fef7:bd81
1310
-
1311
-In the example above, it is OK that the state of the Docker container is unmanaged; Docker handles managing the networking for the containers without using systemd-resolved or systemd-networkd. Instead, Docker manages the container's connection by using its bridge drive.
1312
-
1313
-For more information about `networkctl` commands and options, see https://www.freedesktop.org/software/systemd/man/networkctl.html.
1314
-
1315
-### Turning on Network Debugging
1316
-
1317
-You can set `systemd-networkd` to work in debug mode so that you can analyze log files with debugging information to help troubleshoot networking problems. The following procedure turns on network debugging by adding a drop-in file in /etc/systemd to customize the default systemd configuration in /usr/lib/systemd. 
1318
-
1319
-First, run the following command as root to create a directory with this exact name, including the `.d` extension:
1320
-
1321
-	mkdir -p /etc/systemd/system/systemd-networkd.service.d/
1322
-
1323
-Second, run the following command as root to establish a systemd drop-in unit with a debugging configuration for the network service:
1324
-
1325
-	cat > /etc/systemd/system/systemd-networkd.service.d/10-loglevel-debug.conf << "EOF"
1326
-	[Service]
1327
-	Environment=SYSTEMD_LOG_LEVEL=debug
1328
-	EOF
1329
- 
1330
-You must reload the systemctl daemon and restart the systemd-networkd service for the changes to take effect: 
1331
-
1332
-	systemctl daemon-reload
1333
-	systemctl restart systemd-networkd
1334
-
1335
-Verify that your changes took effect:
1336
-
1337
-	systemd-delta --type=extended
1338
-
1339
-View the log files by running this command: 
1340
-
1341
-	journalctl -u systemd-networkd
1342
-
1343
-When you are finished debugging the network connections, turn debugging off by deleting the drop-in file: 
1344
-
1345
-	rm /etc/systemd/system/systemd-networkd.service.d/10-loglevel-debug.conf
1346
-
1347
-### Mounting a Network File System
1348
-
1349
-To mount a network file system, Photon OS requires nfs-utils. The nfs-utils package contains the daemon, userspace server, and client tools for the kernel Network File System, or NFS. The tools include mount.nfs, umount.nfs, and showmount. 
1350
-
1351
-The nfs-utils package is installed by default in the full version of Photon OS but not in the minimal version. To install nfs-utils in the minimal version, run the following command as root: 
1352
-
1353
-	tdnf install nfs-utils
1354
-
1355
-For instructions on how to use nfs-utils to share files over a network, see [Photon OS nfs-utils](nfs-utils.md).
1356
-
1357
-### Installing the Packages for tcpdump and netcat with tdnf
1358
-
1359
-The minimal version of Photon OS leaves out several useful networking tools to keep the operating system lean. Tcpdump, for example, is absent in the minimal version but available in the repository. The minimal version does, however, include the iproute2 tools by default. 
1360
-
1361
-Tcpdump captures and analyzes packets on a network interface. On Photon OS, you install tcpdump and its accompanying package libpcap, a C/C++ library for capturing network traffic, by using tdnf, Photon's command-line package manager: 
1362
-
1363
-	tdnf install tcpdump
1364
-
1365
-Netcat, a tool for sending data over network connections with TCP or UDP, appears in neither the minimal nor the full version of Photon OS. But since netcat furnishes powerful options for analyzing, troubleshooting, and debugging network connections, you might want to install it. To do so, run the following command: 
1366
-
1367
-	tdnf install netcat
1368
-
1369
-## Cloud-Init on Photon OS
1370
-
1371
-The minimal and full versions of Photon OS include the cloud-init service as a built-in component. Cloud-init is a set of Python scripts that initialize cloud instances of Linux machines. The cloud-init scripts configure SSH keys and run commands to customize the machine without user interaction. The commands can set the root password, create a hostname, configure networking, write files to disk, upgrade packages, run custom scripts, and restart the system. 
1372
-
1373
-There are several ways in which you can deploy Photon OS with cloud-init, including the following: 
1374
-
1375
-* As a stand-alone Photon machine
1376
-* In Amazon Elastic Compute Cloud, called EC2
1377
-* In the Google cloud through the Google Compute Engine, or GCE
1378
-* In a VMware Vsphere private cloud 
1379
-
1380
-When a cloud instance of Photon OS starts, cloud-init requires a data source. The data source can be an EC2 file for Amazon's cloud platform, a seed.iso for a stand-alone instance of Photon OS, or the internal capabilities of a system for managing virtual machines, such as VMware vSphere or vCenter. Cloud-init also includes data sources for OpenStack, Apache CloudStack, and OVF. The data source comprises two parts: 
1381
-
1382
-1. Metadata
1383
-2. User data
1384
-
1385
-The metadata gives the cloud service provider instructions on how to implement the Photon OS machine in the cloud infrastructure. Metadata typically includes the instance ID and the local host name. 
1386
-
1387
-The user data contains the commands and scripts that Photon OS executes when it starts in the cloud. The user data commonly takes the form of a shell script or a YAML file containing a cloud configuration. The [cloud-init documentation](https://launchpad.net/cloud-init and https://cloudinit.readthedocs.org/en/latest/) contains information about the types of data sources and the formats for metadata and user data. 
1388
-
1389
-On Photon OS, cloud-init is enabled and running by default. You can check its status like this: 
1390
-
1391
-	systemctl status cloud-init 
1392
-
1393
-The Photon OS directory that contains the local data and other resources for cloud-init is here: 
1394
-
1395
-	/var/lib/cloud
1396
-
1397
-Photon OS stores the logs for cloud-init in the following file:
1398
-
1399
-	/var/log/cloud-init.log
1400
-
1401
-The following sections demonstrate how to use cloud-init to customize a stand-alone Photon OS machine, instantiate a Photon OS machine in the Amazon EC2 cloud, and deploy a virtual machine running Photon OS in vSphere. Each section uses a different combination of the available options for the metadata and the user data that make up the data source. Specifications, additional options, and examples appear in the cloud-init documentation. 
1402
-
1403
-### Creating a Stand-Alone Photon Machine with cloud-init
1404
-
1405
-Cloud-init can customize a Photon OS virtual machine by using the `nocloud` data source. The nocloud data source bundles the cloud-init metadata and user data into a ISO that acts as a seed when you boot the machine. This seed.iso delivers the metadata and the user data without requiring a network connection. 
1406
-
1407
-Here's how customize a Photon OS VM with a nocloud data source:
1408
-
1409
-First, create the metadata file with the following lines in the [YAML](http://www.yaml.org/start.html) format and name it `meta-data`:
1410
-
1411
-	instance-id: iid-local01
1412
-	local-hostname: cloudimg
1413
-
1414
-Second, create the user data file with the following lines in YAML and name it user-data:
1415
-
1416
-	#cloud-config
1417
-	hostname: testhost
1418
-	packages:
1419
-	 - vim
1420
-
1421
-Third, generate the ISO that will serve as the seed; the ISO must have the volume ID set to `cidata`. In this example, the ISO is generated on an Ubuntu 14.04 computer containing the files named `meta-data` and `user-data` in the local directory: 
1422
-
1423
-	genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
1424
-
1425
-The ISO now appears in the current directory: 
1426
-
1427
-	steve@ubuntu:~$ ls
1428
-	meta-data seed.iso user-data
1429
-
1430
-Optionally, you can check the ISO that you generated on Ubuntu by transferring the ISO to the root directory of your Photon OS machine and then running the following command: 
1431
-
1432
-	cloud-init --file seed.iso --debug init
1433
-
1434
-After running the cloud-init command above, check the cloud-init log file: 
1435
-
1436
-	more /var/log/cloud-init.log
1437
-
1438
-Finally, attach the ISO to the Photon OS virtual machine as a CD-ROM and reboot it so that the changes specified by seed.iso take effect. In this case, cloud-init sets the hostname and adds the vim package.
1439
-
1440
-### Customizing a Photon OS Machine on EC2
1441
-
1442
-This section illustrates how to upload an `ami` image of Photon OS to Amazon Elastic Compute Cloud (EC2) and customize the Photon OS machine by using cloud-init with an EC2 data source. The Amazon machine image version of Photon OS is available as a free download on Bintray:
1443
-
1444
-	https://bintray.com/vmware/photon/
1445
-
1446
-The cloud-init service is commonly used on EC2 to configure the cloud instance of a Linux image. On EC2, for example, cloud-init typically sets the `.ssh/authorized_keys` file to let you log in with a private key from another computer--that is, a computer besides the workstation that you are already using to connect with the Amazon cloud. The cloud-config user-data file that appears in the following example contains abridged SSH authorized keys to show you how to set them. 
1447
-
1448
-Working with EC2 requires Amazon accounts for both AWS and EC2 with valid payment information. If you execute the following examples, you will be charged by Amazon. You will need to replace the `<placeholders>` for access keys and other account information in the examples with your account information. 
1449
-
1450
-The following code assumes you have installed and set up the Amazon AWS CLI and the EC2 CLI tools, including `ec2-ami-tools`. See [Installing the AWS Command Line Interface](http://docs.aws.amazon.com/cli/latest/userguide/installing.html) and [Setting Up the Amazon EC2 Command Line Interface Tools on Linux](http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/set-up-ec2-cli-linux.html). Also see [Setting Up the AMI Tools](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-up-ami-tools.html). 
1451
-
1452
-EC2 requires an SSH key and an RSA certificate. The code in the examples  assumes that you have created SSH keys as well as an RSA user signing certificate and its corresponding private RSA key file.  
1453
-
1454
-Here's a code example that shows how to upload the Photon OS `.ami` image to the Amazon cloud and configure it with cloud-init. The correct virtualization type for Photon OS is `hvm`.   
1455
-
1456
-	$ mkdir bundled
1457
-	$ tar -zxvf ./photon-ami.tar.gz 
1458
-	$ ec2-bundle-image -c ec2-certificate.pem -k ec2-privatekey.pem -u <EC2 account id>  --arch x86_64 --image photon-ami.raw --destination ./bundled/
1459
-	$ aws s3 mb s3://<bucket-name>
1460
-	$ ec2-upload-bundle --manifest ./bundled/photon-ami.manifest.xml --bucket <bucket-name> --access-key <Account Access Key> --secret-key <Account Secret key>
1461
-	$ ec2-register <bucket-name>/photon-ami.manifest.xml --name photon-ami --architecture x86_64 --virtualization-type hvm
1462
-
1463
-In the following command, the `--user-data-file` option instructs cloud-init to import the cloud-config data in `user-data.txt`. The next command assumes you have created the keypair called `mykeypair` and the security group photon-sg as well as uploaded the user-data.txt file; see the EC2 documentation.
1464
-
1465
-    $ ec2-run-instances <ami-ID> --instance-type m3.medium -g photon-sg --key mykeypair --user-data-file user-data.txt
1466
-
1467
-You can now describe the instance to see its ID: 
1468
-
1469
-	$ ec2-describe-instances
1470
-
1471
-And you can run the following command to obtain its public IP address, which you can use to connect to the instance with SSH:
1472
-
1473
-	$ aws ec2 describe-instances --instance-ids <instance-id> --query 'Reservations[*].Instances[*].PublicIpAddress' --output=text
1474
-	$ ec2-describe-images
1475
-
1476
-**Important**: When you are done, run the following commands to terminate the machine. Because Amazon charges you while the host is running, make sure to shut it down:  
1477
-
1478
-	$ ec2-deregister <ami-image-identifier>
1479
-	$ ec2-terminate-instances <instance-id>
1480
-
1481
-Here are the contents of the user-data.txt file that cloud-init applies to the machine the first time that it boots up in the cloud: 
1482
-
1483
-    #cloud-config
1484
-    hostname: photon-on-01
1485
-    groups:
1486
-    - cloud-admins
1487
-    - cloud-users
1488
-    users:
1489
-    - default
1490
-    - name: photonadmin
1491
-       gecos: photon test admin user
1492
-       primary-group: cloud-admins
1493
-       groups: cloud-users
1494
-       lock-passwd: false
1495
-       passwd: vmware
1496
-    - name: photonuser
1497
-       gecos: photon test user
1498
-       primary-group: cloud-users
1499
-       groups: users
1500
-       passwd: vmware
1501
-    packages:
1502
-    - vim
1503
-	ssh_authorized_keys:
1504
-	 - ssh-rsa MIIEogIBAAKCAQEAuvHKAjBhpwuomcUTpIzJWRJAe71JyBgAWrwqyN1Mk5N+c9X5
1505
-	Ru2fazFA7WxQSD1KyTEvcuf8JzdBfrEJ0v3/nT2x63pvJ8fCl6HRkZtHo8zRu8vY
1506
-	KYTZS/sdvM/ruubHfq1ldRpgtYSqbkykoe6PCQIDAQABAoIBAEgveQtjVzHDhLTr
1507
-	rmwJmO316ERfkQ/chLaElhi9qwYJG/jqlNIISWFyztqD1b3fxU6m5MOBIujh7Xpg
1508
-	... ec3test@example.com
1509
-
1510
-Now check the cloud-init output log file on EC2 at `/var/log/cloud-init-output.log`. 
1511
-
1512
-For more information on using cloud-init user data on EC2, see [Running Commands on Your Linux Instance at Launch](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html).
1513
-
1514
-An article on the Photon OS GitHub wiki demonstrates how to get Photon OS up and running on EC2 and run a containerized application in the Docker engine. See [Running Photon OS on Amazon Elastic Cloud Compute](Running-Photon-OS-on-Amazon-Elastic-Cloud-Compute.md).
1515
-
1516
-With Photon OS, you can also build cloud images on Google Compute Engine and other cloud providers; see [Compatible Cloud Images](cloud-images.md).
1517
-
1518
-### Running a Photon OS Machine on GCE
1519
-
1520
-Photon OS comes in a preconfigured image ready for Google Cloud Engine. This section demonstrates how to create a Photon OS instance on Google Cloud Engine with and without cloud-init user data.
1521
-
1522
-This section assumes that you have set up a GCE account and, if you try the examples, are ready to pay Google for its cloud services. The GCE-ready version of Photon OS, however, comes for free. It is, in the parlance of Google cloud services, a private image. You can freely download it without registration from Bintray: 
1523
-
1524
-	https://bintray.com/vmware/photon/gce/view
1525
-
1526
-The GCE-ready image of Photon OS contains packages and scripts that prepare it for the Google cloud to save you time as you implement a compute cluster or develop cloud applications. The GCE-ready version of Photon OS adds the following packages to the [packages installed with the minimal version](https://github.com/vmware/photon/blob/master/common/data/packages_minimal.json): 
1527
-
1528
-	sudo, tar, which, google-daemon, google-startup-scripts, 
1529
-	kubernetes, perl-DBD-SQLite, perl-DBIx-Simple, perl, ntp
1530
-
1531
-In addition to a GCE account, the following examples require the gcloud command-line tool; see [https://cloud.google.com/compute/docs/gcloud-compute](https://cloud.google.com/compute/docs/gcloud-compute).
1532
-
1533
-Here are the commands to create an instance of Photon OS from the Photon GCE image without using cloud-init. In the following commands, you must replace `<bucket-name>` with the name of your bucket. You also need to replace the path to the Photon GCE tar file. 
1534
-
1535
-	$ gcloud compute instances list
1536
-	$ gcloud compute images list
1537
-	$ gcloud config list
1538
-	$ gsutil mb gs://<bucket-name>
1539
-	$ gsutil cp <path-to-photon-gce-image.tar.gz> gs://<bucket-name>/photon-gce.tar.gz
1540
-	$ gcloud compute images create photon-gce-image --source-uri gs://<bucket-name>/photon-gce.tar.gz 
1541
-	$ gcloud compute instances create photon-gce-vm --machine-type "n1-standard-1" --image photon-gce-image
1542
-	$ gcloud compute instances describe photon-gce-vm
1543
-	 
1544
-
1545
-Now, to create a new instance of a Photon OS machine and configure it with a cloud-init user data file, replace the `gcloud compute instances create` command in the example above with the following command. Before running this command, you must upload your user-data file to Google's cloud infrastructure and replace `<path-to-userdata-file>` with its path and file name. 
1546
-
1547
-	gcloud compute instances create photon-gce-vm --machine-type "n1-standard-1" --image photon-gce-vm --metadata-from-file=user-data=<path-to-userdata-file>
1548
-
1549
-You can also add a cloud-init user-data file to an existing instance of a Photon OS machine on GCE: 
1550
-
1551
-	gcloud compute instances add-metadata photon-gce-vm --metadata-from-file=user-data=<path-to-userdata-file>
1552
-
1553
-## Docker Containers
1554
-
1555
-Photon OS includes the open source version of Docker. With Docker, Photon OS becomes a Linux run-time host for containers--that is, a Linux cloud container. A container is a process that runs on the Photon OS host with its own isolated application, file system, and networking.
1556
-
1557
-On Photon OS, the Docker daemon is enabled by default. To view the status of the daemon, run this command: 
1558
-
1559
-	systemctl status docker
1560
-
1561
-Docker is loaded and running by default on the full version of Photon OS. On the minimal version, it is loaded but not running by default, so you have to start it: 
1562
-
1563
-	systemctl start docker
1564
-
1565
-To obtain information about Docker, run this command as root: 
1566
-
1567
-	docker info
1568
-
1569
-After you make sure that docker is enabled and started, you can, for example, run the following docker command as root to create a container running Ubuntu 14.04 with an interactive terminal shell: 
1570
-
1571
-	docker run -i -t ubuntu:14.04 /bin/bash
1572
-
1573
-Photon OS also enables you to run a docker container that, in turn, runs Photon OS: 
1574
-
1575
-	docker run -i -t photon /bin/bash
1576
-
1577
-## Kubernetes
1578
-
1579
-The full version of Photon OS includes Kubernetes so you can manage clusters of containers. For more information, see [Running Kubernetes on Photon OS](kubernetes.md).
1580
-
1581
-## Installing Sendmail
1582
-
1583
-Before you install Sendmail, you should set the fully qualified domain name (FQDN) of your Photon OS machine.
1584
-
1585
-Neither the full nor the minimal version of Photon OS installs Sendmail by default. When you install Sendmail, it provides Photon OS with a systemd service file that typically enables Sendmail. If, however, the service is not enabled after installation, you must enable it. 
1586
-
1587
-Sendmail resides in the Photon extras repository. You can install it with `tdnf` after setting the machine's FQDN. Here's how: 
1588
-
1589
-First, check whether the machine's FQDN is set by running the `hostnamectl status` command:  
1590
-
1591
-         hostnamectl status
1592
-       Static hostname: photon-d9ee400e194e
1593
-             Icon name: computer-vm
1594
-               Chassis: vm
1595
-            Machine ID: a53b414142f944319bd0c8df6d811f36
1596
-               Boot ID: 1f75baca8cc249f79c3794978bd82977
1597
-        Virtualization: vmware
1598
-      Operating System: VMware Photon/Linux
1599
-                Kernel: Linux 4.4.8
1600
-          Architecture: x86-64
1601
-
1602
-In the results above, the FQDN is not set; the Photon OS machine has only a short name. If the FQDN were set, the hostname would be in its full form, typically with a domain name. 
1603
-
1604
-If the machine does not have an FQDN, set one by running `hostnamectl set-hostname new-name`, replacing `new-name` with the FQDN that you want. Example:  
1605
-
1606
-     hostnamectl set-hostname photon-d9ee400e194e.corp.example.com
1607
-
1608
-The `hostnamectl status` command now shows that the machine has an FQDN: 
1609
-
1610
-    root@photon-d9ee400e194e [ ~ ]# hostnamectl status
1611
-       Static hostname: photon-d9ee400e194e.corp.example.com
1612
-             Icon name: computer-vm
1613
-               Chassis: vm
1614
-            Machine ID: a53b414142f944319bd0c8df6d811f36
1615
-               Boot ID: 1f75baca8cc249f79c3794978bd82977
1616
-        Virtualization: vmware
1617
-      Operating System: VMware Photon/Linux
1618
-                Kernel: Linux 4.4.8
1619
-          Architecture: x86-64
1620
-
1621
-Next, install Sendmail: 
1622
-
1623
-    tdnf install sendmail
1624
-
1625
-Make sure it is enabled: 
1626
-
1627
-    systemctl status sendmail
1628
-
1629
-Enable Sendmail if it's disabled and then start it: 
1630
-
1631
-    systemctl enable sendmail
1632
-    systemctl start sendmail
1633
-
1634
-### Fixing Sendmail If Installed Before an FQDN Was Set
1635
-
1636
-If Sendmail is behaving improperly or if it hangs during installation, it is likely that an FQDN is not set. Take the following corrective action. 
1637
-
1638
-First, set an FQDN for your Photon OS machine. 
1639
-
1640
-Then, run the following commands in the order below: 
1641
-
1642
-    echo $(hostname -f) > /etc/mail/local-host-names
1643
-    
1644
-    cat > /etc/mail/aliases << "EOF"
1645
-        postmaster: root
1646
-        MAILER-DAEMON: root
1647
-        EOF
1648
-
1649
-    /bin/newaliases
1650
-
1651
-    cd /etc/mail
1652
-
1653
-    m4 m4/cf.m4 sendmail.mc > sendmail.cf
1654
-
1655
-    chmod 700 /var/spool/clientmqueue
1656
-
1657
-    chown smmsp:smmsp /var/spool/clientmqueue
1658
-
1659
-## Changing the Locale 
1660
-
1661
-You can change the locale if the default locale, shown below by running the `localectl` command, fails to fulfill your requirements: 
1662
-
1663
-    localectl
1664
-    System Locale: LANG=en_US.UTF-8
1665
-       VC Keymap: n/a
1666
-      X11 Layout: n/a
1667
-
1668
-To change the locale, choose the languages that you want from `/usr/share/locale/locale.alias`, add them to `/etc/locale-gen.conf`, and then regenerate the locale list by running the following command as root: 
1669
-
1670
-    locale-gen.sh
1671
-
1672
-Finally, run the following command to set the new locale, replacing the example (`en_US.UTF-8`) with the locale that you want: 
1673
-
1674
-    localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US.UTF-8"
1675
-
1676
-## The Default Security Policy of Photon OS
1677
-
1678
-### Default Firewall Settings
1679
-
1680
-The design of Photon OS emphasizes security. On the minimal and full versions of Photon OS, the default security policy turns on the firewall and drops packets from external interfaces and  applications. As a result, you might need to add rules to iptables to permit forwarding, allow protocols like HTTP, and open ports. In other words, you must configure the firewall for your applications and requirements. 
1681
-
1682
-The default iptables settings on the full version look like this:
1683
-
1684
-    iptables --list
1685
-    Chain INPUT (policy DROP)
1686
-    target     prot opt source               destination
1687
-    ACCEPT     all  --  anywhere             anywhere
1688
-    ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
1689
-    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh
1690
-
1691
-    Chain FORWARD (policy DROP)
1692
-    target     prot opt source               destination
1693
-
1694
-    Chain OUTPUT (policy DROP)
1695
-    target     prot opt source               destination
1696
-    ACCEPT     all  --  anywhere             anywhere
1697
-
1698
-To find out how to adjust the settings, see the man page for iptables. 
1699
-
1700
-Although the default iptables policy accepts SSH connections, the `sshd` configuration file on the full version of Photon OS is set to reject SSH connections. See [Permitting Root Login with SSH](#permitting-root-login-with-ssh).
1701
-
1702
-If you are unable to ping a Photon OS machine, one of the first things you should do is check the firewall rules. Do they allow connectivity for the port and protocol in question? You can supplement the `iptables` commands by using `lsof` commands to, for instance, see the processes listening on ports: 
1703
-
1704
-    lsof -i -P -n
1705
-
1706
-### Default Permissions and umask
1707
-
1708
-The umask on Photon OS is set to `0027`.
1709
-
1710
-When you create a new file with the `touch` command as root, the default on Photon OS is to set the permissions to `0640`--which translates to read-write for user, read for group, and no access for others. Here's an example: 
1711
-
1712
-    touch newfile.md
1713
-    stat newfile.md
1714
-      File: 'newfile.md'
1715
-      Size: 0               Blocks: 0          IO Block: 4096   regular empty file
1716
-    Device: 801h/2049d      Inode: 316454      Links: 1
1717
-    Access: (0640/-rw-r-----)  Uid: (    0/    root)   Gid: (    0/    root)
1718
-
1719
-When you create a directory as root, Photon OS sets the permissions to `0750`:
1720
-
1721
-    mkdir newdir
1722
-    stat newdir
1723
-      File: 'newdir'
1724
-      Size: 4096            Blocks: 8          IO Block: 4096   directory
1725
-    Device: 801h/2049d      Inode: 316455      Links: 2
1726
-    Access: (0750/drwxr-x---)  Uid: (    0/    root)   Gid: (    0/    root)
1727
-
1728
-Because the `mkdir` command uses the umask to modify the permissions placed on newly created files or directories, you can see `umask` at work in the permissions of the new directory: Its default permissions are set at 0750 after the umask subtracts 0027 from the full set of open permissions, 0777.
1729
-
1730
-Similarly, a new file begins as 0666, which you could see if you were to set umask to 0000. But because umask is set by default to 0027, a new file's permissions are set to 0640. 
1731
-
1732
-So be aware of the default permissions on the directories and files that you create. Some system services and applications might require permissions other than the default. The systemd network service, for example, requires user-defined configuration files to be set to 644, not the default of 640. Thus, after you create a network configuration file with a `.network` extension, you must run the `chmod` command to set the new file's mode bits to `644`. Example: 
1733
-
1734
-    chmod 644 10-static-en.network 
1735
-
1736
-For more information on permissions, see the man pages for `stat`, `umask`, and `acl`.
1737
-
1738
-## Disabling TLS 1.0 to Improve Transport Layer Security
1739
-
1740
-Photon OS includes GnuTLS to help secure the transport layer. [GnuTLS](http://www.gnutls.org/) is a library that implements the SSL and TLS protocols to secure communications. 
1741
-
1742
-On Photon OS, SSL 3.0, which contains a known vulnerability, is disabled by default. 
1743
-
1744
-However, TLS 1.0, which also contains known vulnerabilities, is enabled by default.
1745
-
1746
-To turn off TLS 1.0, make a directory named `/etc/gnutls` and then in `/etc/gnutls` create a file named `default-priorities`. In the `default-priorities` file, specify GnuTLS priority strings that remove TLS 1.0 and SSL 3.0 but retain TLS 1.1 and TLS 1.2.
1747
-
1748
-After adding a new `default-priorities` file or after modifying it, you must restart all applications, including SSH, with an open TLS session for the changes to take effect.  
1749
-
1750
-Here is an example of a `default-priorities` file that contains GnuTLS priorities to disable TLS 1.0 and SSL 3.0:  
1751
-
1752
-	cat /etc/gnutls/default-priorities
1753
-	SYSTEM=NONE:!VERS-SSL3.0:!VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL
1754
-
1755
-This example priority string imposes system-specific policies. The NONE keyword means that no algorithms, protocols, or compression methods are enabled, so that you can enable specific versions individually later in the string. The example priority string then specifies that SSL version 3.0 and TLS version 1.0 be removed, as marked by the exclamation point. The priority string then enables, as marked by the plus sign, versions 1.1 and 1.2 of TLS. The cypher is AES-128-CBC. The key exchange is RSA. The MAC is SHA1. And the compression algorithm is COMP-NULL.
1756
-
1757
-On Photon OS, you can verify the system-specific policies in the `default-priorities` file as follows. 
1758
-
1759
-Concatenate the `default-priorities` file to check its contents: 
1760
-
1761
-	root@photon-rc [ ~ ]# cat /etc/gnutls/default-priorities
1762
-	SYSTEM=NONE:!VERS-SSL3.0:!VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL
1763
-
1764
-Run the following command to check the protocols that are enabled for the system: 
1765
-
1766
-	root@photon-rc [ /etc/gnutls ]# gnutls-cli --priority @SYSTEM -l
1767
-	Cipher suites for @SYSTEM
1768
-	TLS_RSA_AES_128_CBC_SHA1                                0x00, 0x2f      SSL3.0
1769
-
1770
-	Certificate types: none
1771
-	Protocols: VERS-TLS1.1, VERS-TLS1.2
1772
-	Compression: COMP-NULL
1773
-	Elliptic curves: none
1774
-	PK-signatures: none
1775
-
1776
-For information about the GnuTLS priority strings, see [https://gnutls.org/manual/html_node/Priority-Strings.html](https://gnutls.org/manual/html_node/Priority-Strings.html).
1777
-
1778
-For information about the vulnerability in SSL 3.0, see [SSL 3.0 Protocol Vulnerability and POODLE Attack](https://www.us-cert.gov/ncas/alerts/TA14-290A).
1779
-
1780
-For information about the vulnerabilities in TLS 1.0, see [Guidelines for the Selection, Configuration, and Use of Transport Layer Security (TLS) Implementations](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-52r1.pdf).
1781
-
1782
-## Working with Repositories and Packages
1783
-
1784
-The design of Photon OS simplifies life-cycle management and improves the security of packages. Photon OS seeks to reduce the burden and complexity of managing clusters of Linux machines by providing curated package repositories and by securing packages with GPG signatures. 
1785
-
1786
-### Photon OS Package Repositories
1787
-
1788
-The default installation of Photon OS includes four yum-compatible repositories plus the repository on the Photon OS ISO when it's available in a CD-ROM drive:  
1789
-
1790
-    ls /etc/yum.repos.d/
1791
-    lightwave.repo
1792
-    photon-extras.repo
1793
-    photon-iso.repo
1794
-    photon-updates.repo
1795
-    photon.repo 
1796
-
1797
-The Photon ISO repository (`photon-iso.repo`) contains the installation packages for Photon OS. All the packages that Photon builds and publishes reside in the RPMs directory of the ISO when it is mounted. The RPMs directory contains metadata that lets it act as a yum repository. Mounting the ISO gives you all the packages corresponding to a Photon OS build. If, however, you built Photon OS yourself from the source code, the packages correspond only to your build, though they will typically be the latest. In contrast, the ISO that you obtain from the Bintray web site contains only the packages that are in the ISO at the point of publication. As a result, the packages may no longer match those on Bintray, which are updated regularly.  
1798
-
1799
-The main Photon OS repository (`photon.repo`) contains all the packages that are built from the ISO or from another source. This repository points to a static batch of packages and spec files at the point of a release. 
1800
-
1801
-The updates repository (`photon-updates.repo`) is irrelevant to a major release until after the release is installed. Thereafter, the updates repository holds the updated packages for that release. The repository, that is, points to updates for the installed version, such as a version of Kubernetes that supersedes the version installed during the major release. 
1802
-
1803
-The Photon extras repository (`photon-extras.repo`) holds Likewise Open, an open source authentication engine, and other VMware software that you can add to Photon OS for free. Photon OS supports but does not build the packages in the extras repository.  
1804
-Similarly, the Lightwave repository (`lightwave.repo`) contains the packages that make up the VMware Lightwave security suite for cloud applications, including tools for identity management, access control, and certificate management.
1805
-
1806
-### Examining Signed Packages
1807
-
1808
-Photon OS signs its packages and repositories with GPG signatures to bolster security. The GPG signature uses keyed-hash authentication method codes, typically the SHA1 algorithm and an MD5 checksum, to simultaneously verify the integrity and authentication of a package. A keyed-hash message authentication code combines a cryptographic hash function with a secret cryptographic key.
1809
-
1810
-In Photon OS, GPG signature verification automatically takes place when you install or update a package with the default package manager, tdnf. The default setting in the tdnf configuration file for checking the GPG is set to `1`, for true:  
1811
-
1812
-    cat /etc/tdnf/tdnf.conf
1813
-    [main]
1814
-    gpgcheck=1
1815
-    installonly_limit=3
1816
-    clean_requirements_on_remove=true
1817
-    repodir=/etc/yum.repos.d
1818
-    cachedir=/var/cache/tdnf
1819
-
1820
-On Photon OS, you can view the key with which VMware signs packages by running the following command:  
1821
-
1822
-    rpm -qa gpg-pubkey*
1823
-
1824
-The command returns the GPG public key:
1825
-
1826
-    gpg-pubkey-66fd4949-4803fe57
1827
-
1828
-Once you have the name of the key, you can view information about the key with the `rpm -qi` command, as the following abridged output demonstrates: 
1829
-
1830
-    rpm -qi gpg-pubkey-66fd4949-4803fe57
1831
-    Name        : gpg-pubkey
1832
-    Version     : 66fd4949
1833
-    Release     : 4803fe57
1834
-    Architecture: (none)
1835
-    Install Date: Thu Jun 16 11:51:39 2016
1836
-    Group       : Public Keys
1837
-    Size        : 0
1838
-    License     : pubkey
1839
-    Signature   : (none)
1840
-    Source RPM  : (none)
1841
-    Build Date  : Tue Apr 15 01:01:11 2008
1842
-    Build Host  : localhost
1843
-    Relocations : (not relocatable)
1844
-    Packager    : VMware, Inc. -- Linux Packaging Key -- <linux-packages@vmware.com>
1845
-    Summary     : gpg(VMware, Inc. -- Linux Packaging Key -- <linux-packages@vmware.                        com>)
1846
-    Description :
1847
-    -----BEGIN PGP PUBLIC KEY BLOCK-----
1848
-    Version: rpm-4.11.2 (NSS-3)
1849
-    mI0ESAP+VwEEAMZylR8dOijUPNn3He3GdgM/kOXEhn3uQl+sRMNJUDm1qebi2D5b ...
1850
-
1851
-If you have one of the RPMs from Photon OS on another Linux system, such as Ubuntu, you can check the status of the SHA and MD5 for the package to verify that it has not been tampered with:
1852
-
1853
-    rpm -K /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm
1854
-    /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm: sha1 md5 OK
1855
-
1856
-And then you can view the SHA1 digest and the MD5 digest by running the following command: 
1857
-
1858
-    rpm -Kv /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm
1859
-    /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm:
1860
-    Header SHA1 digest: OK (89b55443d4c9f67a61ae0c1ec9bf4ece2d6aa32b)
1861
-            MD5 digest: OK (51eee659a8730e25fd2a52aff9a6c2c2)
1862
-
1863
-The above examples show that the Kubernetes package has not been tampered with.
1864
-
1865
-### Building a Package from a Source RPM
1866
-
1867
-This section describes how to install and build a package on the full version of Photon OS from the package's source RPM. You obtain the source RPMs that Photon OS uses from Bintray: 
1868
-
1869
-[https://bintray.com/vmware/photon](https://bintray.com/vmware/photon)
1870
-
1871
-To build a package from its source RPM, or SRPM, Photon OS requires the following packages:  
1872
-
1873
-* rpmbuild. This package is installed by default on the full version of Photon OS, so you should not have to install it. 
1874
-* gcc. This package is also installed by default on the full version of Photon OS, so you should not have to install it. 
1875
-* make, Cmake, automake, or another make package, depending on the package you are trying to install and build from its source RPM. Cmake is installed by default on Photon OS. You can install other make packages if need be by using tdnf or yum.  
1876
-
1877
-Another requirement is a local unprivileged user account other than the root account. You should build RPMs as an unprivileged user. Do not build a package as root--building an RPM with the root account might damage your system. 
1878
-
1879
-If you are building a package on a virtual machine running Photon OS in VMware vSphere, VMware Workstation, or VMware Fusion, take a snapshot of your virtual machine before building the package. 
1880
-
1881
-VMware recommends that you install and build packages from their source RPMs on the full version of Photon OS. Do not use the minimal version to work with source RPMs.  
1882
-
1883
-Here's how to install and build an example package--sed, in this case--from its source RPM on Photon OS with an unprivileged account. 
1884
-
1885
-First, check whether rpmbuild is installed by running the following command: 
1886
-
1887
-	rpmbuild --version
1888
-
1889
-If it is not installed, install it by running the following command as root: 
1890
-
1891
-	tdnf install rpm-build
1892
-
1893
-Second, create the directories for building RPMs under your local user account's home directory (not under root):
1894
-
1895
-	mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
1896
-
1897
-Next, create a .rpmmacros file under your home directory and override the default location of the RPM building tree with the new one. This command overwrites an existing .rpmmacros file. Before running the following command, make sure you do not already have a .rpmmacros file; if a .rpmmacros file exists, back it up under a new name in case you want to restore it later. 
1898
-
1899
-	echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
1900
-
1901
-Now place the source RPM file that you want to install and build in the /tmp directory. 
1902
-
1903
-To install the source file, run the following command with your unprivileged user account, replacing the sed example source RPM with the name of the one that you want to install: 
1904
-
1905
-	rpm -i /tmp/sed-4.2.2-2.ph1.src.rpm
1906
-
1907
-The above command unpacks the source RPM and places its .spec file in your ~/rpmbuild/SPECS directory. In the next step, the rpmbuild tool uses the .spec file to build the RPM. 
1908
-
1909
-To build the RPM, run the following commands with your unprivileged user account. Again, replace the sed.spec example file with the name of the .spec file that you want to build. 
1910
-
1911
-	cd ~/rpmbuild/SPECS
1912
-	rpmbuild -ba sed.spec
1913
-
1914
-If successful, the rpmbuild -ba command builds the RPM and generates an RPM package file in your ~/rpmbuild/RPMS/x86_64 directory. Example:
1915
-
1916
-	ls RPMS/x86_64/
1917
-	sed-4.2.2-2.x86_64.rpm  sed-debuginfo-4.2.2-2.x86_64.rpm  sed-lang-4.2.2-2.x86_64.rpm
1918
-
1919
-The rpmbuild command also generates a new SRPM file and saves it in your ~/rpmbuild/SRPMS directory. Example:  
1920
-
1921
-	ls SRPMS/
1922
-	sed-4.2.2-2.src.rpm
1923
-
1924
-If the rpmbuild command is unsuccessful with an error that it cannot find a library, you must install the RPMs for the library that your source RPM depends on before you can successfully build your source RPM. Iterate through installing the libraries that your source RPM relies on until you can successfully build it. 
1925
-
1926
-To install the RPM, run the following command with your unprivileged user account:  
1927
-
1928
-	rpm -i RPMS/x86_64/sed-4.2.2-2.x86_64.rpm
1929
-
1930
-### Compiling C++ Code on the Minimal Version of Photon OS
1931
-
1932
-As a minimalist Linux run-time environment, the minimal version of Photon OS lacks the packages that you need to compile the code for a C++ program. For example, without the requisite packages, trying to compile the file containing the following code with the `gcc` command will generate errors: 
1933
-
1934
-    #include <stdio.h>
1935
-    int main()
1936
-    {
1937
-    return 0;
1938
-    }
1939
-
1940
-The errors look something like this: 
1941
-
1942
-    gcc test.c
1943
-    -bash: gcc: command not found
1944
-    tdnf install gcc -y
1945
-    gcc test.c
1946
-    test.c:1:19: fatal error: stdio.h: No such file or directory
1947
-    compilation terminated.
1948
-
1949
-To enable the minimal version of Photon OS to preprocess, compile, assemble, and link C++ code, you must install the following packages as root with tdnf:
1950
-
1951
-* gcc
1952
-* glibc-devel
1953
-* binutils
1954
-
1955
-Here's the `tdnf` command to install these packages: 
1956
-
1957
-    tdnf install gcc glibc-devel binutils
1958
-
1959
-## References
1960
-
1961
-* [Photon OS Getting Started Guides](getting-started-guides.md)
1962
-* [Photon OS Troubleshooting Guide](photon-os-troubleshooting-guide.md)
1963
-* [FAQ](Frequently-Asked-Questions.md)
1964 1
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+# Photon OS Administration Guide
1
+
2
+The *Photon OS Administration Guide* describes the fundamentals of administering Photon OS. 
3
+
4
+The *Photon OS Administration Guide* covers the basics of managing packages, controlling services with systemd, setting up networking, initializing Photon OS with cloud-init, running Docker containers, and working with other technologies, such as Kubernetes. 
5
+
6
+**Product version: 3.0**
7
+
8
+This documentation applies to all 3.0.x releases.
9
+
10
+## Intended Audiences
11
+
12
+This information is intended for Photon OS administrators who install and set up Photon OS.
13
+
14
+----------
15
+
16
+Copyright &copy; 2016-2018 VMware, Inc. All rights reserved. [Copyright and trademark information](http://pubs.vmware.com/copyright-trademark.html). Any feedback you provide to VMware is subject to the terms at [www.vmware.com/community_terms.html](http://www.vmware.com/community_terms.html).
17
+
18
+**VMware, Inc.**<br>
19
+3401 Hillview Ave.<br>
20
+Palo Alto, CA 94304
21
+
22
+[www.vmware.com](http://www.vmware.com)
0 23
new file mode 100644
... ...
@@ -0,0 +1,92 @@
0
+# Photon OS Administration Guide
1
+
2
+
3
+
4
+- [Photon OS Administration Guide](README.md)
5
+-   [Introduction](introduction.md)
6
+    -   [Examining the Packages in the SPECS Directory on Github](examining_packages_spec_dir.md)
7
+    -   [Looking at the Differences Between the Minimal and the Full
8
+        Version](differences_between_minimal_and_full_version.md)
9
+    -   [The Root Account and the `sudo` and `su`
10
+        Commands](root_account_and_sudo_commands.md)
11
+-   [Tiny DNF for Package
12
+    Management](tiny-dnf-for-package-management.md)
13
+    -   [Configuration Files and
14
+        Repositories](configuration-files-and-repositories.md)
15
+    -   [Options for Commands](options-for-commands.md)
16
+    -   [Commands](commands.md)
17
+    -   [Adding a New Repository](adding-a-new-repository.md)
18
+    -   [Adding the Dev Repository to Get New Packages from the
19
+        GitHub Dev
20
+        Branch](adding-the-dev-repository.md)
21
+-   [Managing Services with
22
+    systemd](managing-services-with-systemd.md)
23
+    -   [Viewing Services](viewing-services.md)
24
+    -   [Controlling Services](controlling-services.md)
25
+    -   [Creating a Startup Service](creating-a-startup-service.md)
26
+    -   [Disabling the Photon OS
27
+        httpd.service](disabling-the-photon-os-httpd.service.md)
28
+    -   [Auditing System Events with
29
+        auditd](auditing-system-events-with-auditd.md)
30
+    -   [Analyzing systemd Logs with
31
+        journalctl](analyzing-systemd-logs-with-journalctl.md)
32
+    -   [Migrating Scripts to
33
+        systemd](migrating-scripts-to-systemd.md)
34
+-   [Managing the Network
35
+    Configuration](managing-the-network-configuration.md)
36
+    -   [Using the Network Configuration Manager](using-the-network-configuration-manager.md)
37
+    -   [Use `ip` and `ss` Commands Instead of `ifconfig` and
38
+        `netstat`](use-ip-and-ss-commands.md)
39
+    -   [Configuring Network
40
+        Interfaces](configuring-network-interfaces.md)
41
+    -   [Setting a Static IP Address](setting-a-static-ip-address.md)
42
+    -   [Turning Off DHCP](turning-off-dhcp.md)
43
+    -   [Adding a DNS Server](adding-a-dns-server.md)
44
+    -   [Setting Up Networking for Multiple
45
+        NICs](setting-up-networking-for-multiple-nics.md)
46
+    -   [Combining DHCP and Static IP Addresses with IPv4 and
47
+        IPv6](combining-dhcp-and-static-ip-addresses-with-ipv4-and-ipv6.md)
48
+    -   [Clearing the Machine ID of a Cloned Instance for
49
+        DHCP](clearing-the-machine-id-of-a-cloned-instance-for-dhcp.md)
50
+    -   [Using Predictable Network Interface
51
+        Names](using-predictable-network-interface-names.md)
52
+    -   [Inspecting the Status of Network Links with
53
+        `networkctl`](inspecting-the-status-of-network-links-with-networkctl.md)
54
+    -   [Turning on Network
55
+        Debugging](turning-on-network-debugging.md)
56
+    -   [Mounting a Network File
57
+        System](mounting-a-network-file-system.md)
58
+    -   [Installing the Packages for tcpdump and netcat with
59
+        tdnf](installing-the-packages-for-tcpdump-and-netcat-with-tdnf.md)
60
+-   [Cloud-Init on Photon OS](cloud-init-on-photon-os.md)
61
+    -   [Creating a Stand-Alone Photon Machine with
62
+        cloud-init](creating-a-stand-alone-photon-machine-with-cloud-init.md)
63
+    -   [Customizing a Photon OS Machine on
64
+        EC2](customizing-a-photon-os-machine-on-ec2.md)
65
+    -   [Running a Photon OS Machine on
66
+        GCE](running-a-photon-os-machine-on-gce.md)
67
+-   [Docker Containers](docker-containers.md)
68
+-   [Kubernetes](kubernetes.md)
69
+-   [Installing Sendmail](installing-sendmail.md
70
+-   [Changing the Locale](changing-the-locale.md)
71
+-   [The Default Security Policy of Photon
72
+    OS](default-security-policy-of-photon-os.md)
73
+    -   [Default Firewall Settings](default-firewall-settings.md)
74
+    -   [Default Permissions and
75
+        umask](default-permissions-and-umask.md)
76
+-   [Disabling TLS 1.0 to Improve Transport Layer
77
+    Security](disabling-tls.md)
78
+-   [Working with Repositories and
79
+    Packages](working-with-repositories-and-packages.md)
80
+    -   [Photon OS Package
81
+        Repositories](photon-os-package-repositories.md)
82
+    -   [Examining Signed Packages](signed-packages.md)
83
+    -   [Building a Package from a Source
84
+        RPM](building-a-package-from-a-source-rpm.md)
85
+    -   [Compiling C++ Code on the Minimal Version of Photon
86
+        OS](compiling-c-code-on-the-minimal-version-of-photon-os.md)
87
+- [Photon Management Daemon Command-line Interface (pmd-cli)](pmd-cli.md)
88
+- [Network Configuration Manager - C API](netmgr.c.md)
89
+- [Photon Network Manager Command-line Interface (netmgr)](netmgr-cli.md)
90
+- [Network Configuration Manager - Python API](netmgr.python.md)
91
+- [Managing Packages in Photon OS with tdnf](tdnf.md)        
0 92
new file mode 100644
... ...
@@ -0,0 +1,35 @@
0
+# Adding a DNS Server 
1
+
2
+Photon OS resolves domain names, IP addresses, and network names for local applications by using systemd-resolved. The systemd-resolved daemon automatically creates and maintains the /etc/resolv.conf file, into which systemd-resolved places the IP address of the DNS server. You should therefore never modify the /etc/resolv.conf file.
3
+
4
+(If you want to implement a local resolver like bind instead of systemd-resolved, stop the systemd-resolved service and disable it.)
5
+
6
+If you open the default /etc/resolv.conf file after you deploy Photon OS, it looks like this: 
7
+
8
+	root@photon-rc [ ~ ]# cat /etc/resolv.conf
9
+	# This file is managed by systemd-resolved(8). Do not edit.
10
+	#
11
+	# Third party programs must not access this file directly, but
12
+	# only through the symlink at /etc/resolv.conf. To manage
13
+	# resolv.conf(5) in a different way, replace the symlink by a
14
+	# static file or a different symlink.
15
+
16
+	nameserver 198.51.100.2
17
+
18
+To add a DNS server to your static network configuration file, insert a DNS key into the Network section of, in this example, /etc/systemd/network/10-eth0-static.network and set it to the IP address of your DNS server: 
19
+
20
+	[Match]
21
+	Name=e*
22
+
23
+	[Network]
24
+	Address=198.51.0.2/24
25
+	Gateway=198.51.0.1
26
+	DNS=198.51.0.1
27
+
28
+Another way of adding a DNS server is to modify /etc/systemd/resolved.conf--a method that can be particularly useful when your machine is working with DHCP. For more information, see https://www.freedesktop.org/software/systemd/man/resolved.conf.html.
29
+
30
+You can optionally activate the local DNS stub resolver of systemd-resolved by adding `dns` and `resolve` to /etc/nsswitch.conf. To do so, make a backup copy of /etc/nsswitch.conf and then execute the following command as root:
31
+
32
+	sed -i 's/^hosts.*$/hosts: files resolve dns/' /etc/nsswitch.conf
33
+
34
+For more information on the systemd-resolved service, see https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html.
0 35
\ No newline at end of file
1 36
new file mode 100644
... ...
@@ -0,0 +1,61 @@
0
+# Adding a New Repository
1
+
2
+On Photon OS, you can add a new repository from which `tdnf` installs packages. To add a new repository, you create a repository configuration file with a `.repo` extension and place it in `/etc/yum.repos.d`. The repository can be on either the Internet or a local server containing your in-house applications. 
3
+
4
+Be careful if you add a repository  that is on the Internet. Installing packages from untrusted or unverified sources might put the security, stability, or compatibility of your system at risk. It might also make your system harder to maintain.  
5
+
6
+On Photon OS, the existing repositories appear in the `/etc/yum.repos.d` directory:
7
+
8
+	ls /etc/yum.repos.d/
9
+	lightwave.repo
10
+	photon-extras.repo
11
+	photon-iso.repo
12
+	photon-updates.repo
13
+	photon.repo 
14
+
15
+To view the the format and information that a new repository configuration file should contain, see one of the `.repo` files. The following is an example:
16
+
17
+	cat /etc/yum.repos.d/lightwave.repo
18
+	[lightwave]
19
+	name=VMware Lightwave 1.0(x86_64)
20
+	baseurl=https://dl.bintray.com/vmware/lightwave
21
+	gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
22
+	gpgcheck=1
23
+	enabled=1
24
+	skip_if_unavailable=True
25
+
26
+The minimal information needed to establish a repository is an ID and human-readable name of the repository and its base URL. The ID, which appears in square brackets, must be one word that is unique amoung the system's repositories; in the example above, it is `[lightwave]`.
27
+
28
+The `baseurl` is a URL for the repository's repodata directory. For a repository on a local server that can be accessed directly or mounted as a file system, the base URL can be a file referenced by `file://`. Example:  
29
+
30
+	baseurl=file:///server/repo/
31
+
32
+The `gpgcheck` setting specifies whether to check the GPG signature. The `gpgkey` setting furnishes the URL for the repository's ASCII-armored GPG key file. Tdnf uses the GPG key to verify a package if its key has not been imported into the RPM database.
33
+
34
+The `enabled` setting tells `tdnf` whether to poll the repository. If `enabled` is set to `1`, `tdnf` polls it; if it is set to `0`, `tdnf` ignores it. 
35
+
36
+The `skip_if_unavailable` setting instructs `tdnf` to continue running if the repository goes offline.
37
+
38
+Other options and variables can appear in the repository file. The variables that are used with some of the options can reduce future changes to the repository configuration files. There are variables to replace the value of the version of the package and to replace the base architecture. For more information, see the man page for `yum.conf` on the full version of Photon OS: `man yum.conf`
39
+
40
+The following is an example of how to add a new repository for a local server that `tdnf` polls for packages:
41
+
42
+	cat > /etc/yum.repos.d/apps.repo << "EOF"
43
+	[localapps]
44
+	name=Local In-House Applications(x86_64)
45
+	baseurl=file:///appserver/apps
46
+	enabled=1
47
+	skip_if_unavailable=True
48
+	EOF
49
+
50
+Because this new repository resides on a local server, make sure the Photon OS machine can connect to it by mounting it. 
51
+
52
+After establishing a new repository, you must run the following command to update the cached binary metadata for the repositories that `tdnf` polls:
53
+
54
+	tdnf makecache
55
+	Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
56
+	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
57
+	Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
58
+	Refreshing metadata for: 'Local In-House Applications(x86_64)'
59
+	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
60
+	Metadata cache created.
0 61
\ No newline at end of file
1 62
new file mode 100644
... ...
@@ -0,0 +1,25 @@
0
+# Adding the Dev Repository to Get New Packages from the GitHub Dev Branch
1
+
2
+To try out new packages or the latest versions of existing packages as they are merged into the dev branch of the Photon OS GitHub site, add the `dev` repository to your repository list.
3
+
4
+Perform th following steps:
5
+
6
+1. On your Photon OS machine, run the following command as root to create a repository configuration file named `photon-dev.repo`, place it in `/etc/yum.repos.d`, and concatenate the repository information into the file: 
7
+```
8
+cat > /etc/yum.repos.d/photon-dev.repo << "EOF" 
9
+    [photon-dev]
10
+    name=VMware Photon Linux Dev(x86_64)
11
+    baseurl=https://dl.bintray.com/vmware/photon_dev_$basearch
12
+    gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
13
+    gpgcheck=1
14
+    enabled=1
15
+    skip_if_unavailable=True
16
+    EOF
17
+``` . 
18
+
19
+2. After establishing a new repository, run the following command to update the cached binary metadata for the repositories that `tdnf` polls: 
20
+    
21
+```
22
+tdnf makecache
23
+```
24
+
0 25
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+# Analyzing systemd Logs with journalctl
1
+
2
+The `journalctl` tool queries the contents of the `systemd` journal. 
3
+
4
+The following command displays the messages that `systemd` generated the last time the machine started: 
5
+
6
+	journalctl -b
7
+
8
+The following command reveals the messages for the systemd service unit specified by the `-u` option:
9
+
10
+	journalctl -u auditd
11
+	
12
+In the above example, `auditd` is the system service unit.
13
+
14
+For more information, see the `journalctl` man page by running the following command on Photon OS: 
15
+
16
+```
17
+man journalctl
18
+```
0 19
new file mode 100644
... ...
@@ -0,0 +1,38 @@
0
+# Auditing System Events with auditd
1
+
2
+To manage security on Photon OS, the Linux auditing service `auditd` is enabled and active by default on the full version of Photon OS.
3
+
4
+The folloiwng command shows the security status:
5
+	
6
+```
7
+systemctl status auditd
8
+	* auditd.service - Security Auditing Service
9
+	   Loaded: loaded (/usr/lib/systemd/system/auditd.service; enabled; vendor preset: enabled)
10
+	   Active: active (running) since Fri 2016-04-29 15:08:50 UTC; 1 months 9 days ago
11
+	 Main PID: 250 (auditd)
12
+	   CGroup: /system.slice/auditd.service
13
+	           `-250 /sbin/auditd -n
14
+```
15
+
16
+To help improve security, the `auditd` service can monitor file changes, system calls, executed commands, authentication events, and network access. After you implement an audit rule to monitor an event, the `aureport` tool generates reports to display information about the events. 
17
+
18
+You can use the auditctl utility to set a rule that monitors the `sudoers` file for changes:
19
+
20
+	auditctl -w /etc/sudoers -p wa -k sudoers_changes
21
+
22
+This rule specifies that the auditd service must watch (`-w`) the `/etc/sudoers` file to log permissions changes (`-p`) to the write access (`w`) or attributes (`a`) of the file and to identify them in logs as `sudoers_changes`. The auditing logs appear in `/var/log/audit/audit.log`. You can list the auditing rules as follows: 
23
+
24
+	auditctl -l
25
+	-w /etc/sudoers -p wa -k sudoers_changes
26
+
27
+For more information on the Linux Audit Daemon, see the `auditd` man page: 
28
+
29
+	man auditd
30
+
31
+For more information on setting auditing rules and options, see the `auditctl` man page:
32
+
33
+	man auditctl
34
+
35
+For more information on viewing reports on audited events, see the `aureport` man page:
36
+
37
+	man aureport
0 38
\ No newline at end of file
1 39
new file mode 100644
... ...
@@ -0,0 +1,64 @@
0
+# Building a Package from a Source RPM
1
+
2
+This section describes how to install and build a package on the full version of Photon OS from the package's source RPM. You obtain the source RPMs that Photon OS uses from Bintray: 
3
+
4
+[https://bintray.com/vmware/photon](https://bintray.com/vmware/photon)
5
+
6
+To build a package from its source RPM, or SRPM, Photon OS requires the following packages:  
7
+
8
+* rpmbuild. This package is installed by default on the full version of Photon OS, so you should not have to install it. 
9
+* gcc. This package is also installed by default on the full version of Photon OS, so you should not have to install it. 
10
+* make, Cmake, automake, or another make package, depending on the package you are trying to install and build from its source RPM. Cmake is installed by default on Photon OS. You can install other make packages if need be by using tdnf or yum.  
11
+
12
+Another requirement is a local unprivileged user account other than the root account. You should build RPMs as an unprivileged user. Do not build a package as root--building an RPM with the root account might damage your system. 
13
+
14
+If you are building a package on a virtual machine running Photon OS in VMware vSphere, VMware Workstation, or VMware Fusion, take a snapshot of your virtual machine before building the package. 
15
+
16
+VMware recommends that you install and build packages from their source RPMs on the full version of Photon OS. Do not use the minimal version to work with source RPMs.  
17
+
18
+Here's how to install and build an example package--sed, in this case--from its source RPM on Photon OS with an unprivileged account. 
19
+
20
+First, check whether rpmbuild is installed by running the following command: 
21
+
22
+	rpmbuild --version
23
+
24
+If it is not installed, install it by running the following command as root: 
25
+
26
+	tdnf install rpm-build
27
+
28
+Second, create the directories for building RPMs under your local user account's home directory (not under root):
29
+
30
+	mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
31
+
32
+Next, create a .rpmmacros file under your home directory and override the default location of the RPM building tree with the new one. This command overwrites an existing .rpmmacros file. Before running the following command, make sure you do not already have a .rpmmacros file; if a .rpmmacros file exists, back it up under a new name in case you want to restore it later. 
33
+
34
+	echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
35
+
36
+Now place the source RPM file that you want to install and build in the /tmp directory. 
37
+
38
+To install the source file, run the following command with your unprivileged user account, replacing the sed example source RPM with the name of the one that you want to install: 
39
+
40
+	rpm -i /tmp/sed-4.2.2-2.ph1.src.rpm
41
+
42
+The above command unpacks the source RPM and places its .spec file in your ~/rpmbuild/SPECS directory. In the next step, the rpmbuild tool uses the .spec file to build the RPM. 
43
+
44
+To build the RPM, run the following commands with your unprivileged user account. Again, replace the sed.spec example file with the name of the .spec file that you want to build. 
45
+
46
+	cd ~/rpmbuild/SPECS
47
+	rpmbuild -ba sed.spec
48
+
49
+If successful, the rpmbuild -ba command builds the RPM and generates an RPM package file in your ~/rpmbuild/RPMS/x86_64 directory. Example:
50
+
51
+	ls RPMS/x86_64/
52
+	sed-4.2.2-2.x86_64.rpm  sed-debuginfo-4.2.2-2.x86_64.rpm  sed-lang-4.2.2-2.x86_64.rpm
53
+
54
+The rpmbuild command also generates a new SRPM file and saves it in your ~/rpmbuild/SRPMS directory. Example:  
55
+
56
+	ls SRPMS/
57
+	sed-4.2.2-2.src.rpm
58
+
59
+If the rpmbuild command is unsuccessful with an error that it cannot find a library, you must install the RPMs for the library that your source RPM depends on before you can successfully build your source RPM. Iterate through installing the libraries that your source RPM relies on until you can successfully build it. 
60
+
61
+To install the RPM, run the following command with your unprivileged user account:  
62
+
63
+	rpm -i RPMS/x86_64/sed-4.2.2-2.x86_64.rpm
0 64
\ No newline at end of file
1 65
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+# Changing the Locale 
1
+
2
+You can change the locale if the default locale, shown below by running the `localectl` command, fails to fulfill your requirements: 
3
+
4
+    localectl
5
+    System Locale: LANG=en_US.UTF-8
6
+       VC Keymap: n/a
7
+      X11 Layout: n/a
8
+
9
+To change the locale, choose the languages that you want from `/usr/share/locale/locale.alias`, add them to `/etc/locale-gen.conf`, and then regenerate the locale list by running the following command as root: 
10
+
11
+    locale-gen.sh
12
+
13
+Finally, run the following command to set the new locale, replacing the example (`en_US.UTF-8`) with the locale that you want: 
14
+
15
+    localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US.UTF-8"
0 16
\ No newline at end of file
1 17
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+# Clearing the Machine ID of a Cloned Instance for DHCP
1
+
2
+Photon OS uses the contents of `/etc/machine-id` to determine the DHCP unique identifier (duid) that is used for DHCP requests. If you use a Photon OS instance as the base system for cloning to create additional Photon OS instances, you should clear the machine-id with this command: 
3
+
4
+    echo -n > /etc/machine-id
5
+
6
+With the value cleared, systemd regenerates the machine-id and, as a result, all DHCP requests will contain a unique duid. 
0 7
\ No newline at end of file
1 8
new file mode 100644
... ...
@@ -0,0 +1,33 @@
0
+# Cloud-Init on Photon OS
1
+
2
+The minimal and full versions of Photon OS include the cloud-init service as a built-in component. Cloud-init is a set of Python scripts that initialize cloud instances of Linux machines. The cloud-init scripts configure SSH keys and run commands to customize the machine without user interaction. The commands can set the root password, create a hostname, configure networking, write files to disk, upgrade packages, run custom scripts, and restart the system. 
3
+
4
+There are several ways in which you can deploy Photon OS with cloud-init, including the following: 
5
+
6
+* As a stand-alone Photon machine
7
+* In Amazon Elastic Compute Cloud, called EC2
8
+* In the Google cloud through the Google Compute Engine, or GCE
9
+* In a VMware Vsphere private cloud 
10
+
11
+When a cloud instance of Photon OS starts, cloud-init requires a data source. The data source can be an EC2 file for Amazon's cloud platform, a seed.iso for a stand-alone instance of Photon OS, or the internal capabilities of a system for managing virtual machines, such as VMware vSphere or vCenter. Cloud-init also includes data sources for OpenStack, Apache CloudStack, and OVF. The data source comprises two parts: 
12
+
13
+1. Metadata
14
+2. User data
15
+
16
+The metadata gives the cloud service provider instructions on how to implement the Photon OS machine in the cloud infrastructure. Metadata typically includes the instance ID and the local host name. 
17
+
18
+The user data contains the commands and scripts that Photon OS executes when it starts in the cloud. The user data commonly takes the form of a shell script or a YAML file containing a cloud configuration. The [cloud-init documentation](https://launchpad.net/cloud-init and https://cloudinit.readthedocs.org/en/latest/) contains information about the types of data sources and the formats for metadata and user data. 
19
+
20
+On Photon OS, cloud-init is enabled and running by default. You can check its status like this: 
21
+
22
+	systemctl status cloud-init 
23
+
24
+The Photon OS directory that contains the local data and other resources for cloud-init is here: 
25
+
26
+	/var/lib/cloud
27
+
28
+Photon OS stores the logs for cloud-init in the following file:
29
+
30
+	/var/log/cloud-init.log
31
+
32
+The following sections demonstrate how to use cloud-init to customize a stand-alone Photon OS machine, instantiate a Photon OS machine in the Amazon EC2 cloud, and deploy a virtual machine running Photon OS in vSphere. Each section uses a different combination of the available options for the metadata and the user data that make up the data source. Specifications, additional options, and examples appear in the cloud-init documentation. 
0 33
\ No newline at end of file
1 34
new file mode 100644
... ...
@@ -0,0 +1,41 @@
0
+# Combining DHCP and Static IP Addresses with IPv4 and IPv6 
1
+
2
+This section presents examples that demonstrate how to combine DHCP and static IP addresses with both IPv4 and IPv6. 
3
+
4
+Here's how to use DHCP to allocate both IPv4 and IPv6 addresses:
5
+
6
+	[Network]
7
+	DHCP=yes
8
+
9
+Here's how to use DHCP to allocate only IPv4 addresses:
10
+
11
+	[Network]
12
+	DHCP=ipv4
13
+
14
+Here's how to use DHCP to allocate only IPv6 addresses:
15
+
16
+	[Network]
17
+	DHCP=ipv6
18
+
19
+Here's how to use DHCP for IPv4 addresses and static IP addresses for IPv6 addresses: 
20
+
21
+	[Network]
22
+	DHCP=ipv4
23
+	Address=fd00::1/48
24
+	Gateway=fd00::252
25
+
26
+Here's how to use DHCP for IPv6 addresses and static IP addresses for IPv4: 
27
+
28
+	[Network]
29
+	DHCP=ipv6
30
+	Address=10.10.10.1/24
31
+	Gateway=10.10.10.253
32
+
33
+Here's how to use static IP addresses for both IPv4 and IPv6: 
34
+
35
+	[Network]
36
+	DHCP=ipv6
37
+	Address=10.10.10.1/24
38
+	Gateway=10.10.10.253
39
+	Address=fd00::1/48
40
+	Gateway=fd00::252
0 41
\ No newline at end of file
1 42
new file mode 100644
... ...
@@ -0,0 +1,190 @@
0
+# Commands
1
+
2
+**check**: Checks for problems in installed and available packages for all enabled repositories. The command has no arguments. You can use ``--enablerepo`` and ``--disablerepo`` to control the repos used. Supported in Photon OS 2.0 (only).
3
+
4
+**check-local**: This command resolves dependencies by using the local RPMs to help check RPMs for quality assurance before publishing them. To check RPMs with this command, you must create a local directory and place your RPMs in it. The command, which includes no options, takes the path to the local directory containing the RPMs as its argument. The command does not recursively parse directories. It checks the RPMs only in the directory that you specify. For example, after creating a directory named `/tmp/myrpms` and placing your RPMs in it, you can run the following command to check them:  
5
+
6
+	tdnf check-local /tmp/myrpms
7
+	Checking all packages from: /tmp/myrpms
8
+	Found 10 packages
9
+	Check completed without issues
10
+
11
+**check-update**: This command checks for updates to packages. It takes no arguments. The `tdnf list updates` command performs the same function. Here is an example of the `check update` command: 
12
+
13
+	tdnf check-update
14
+	rpm-devel.x86_64 	4.11.2-8.ph1 	photon
15
+	yum.noarch      	3.4.3-3.ph1 	photon
16
+
17
+**clean**: This command cleans up temporary files, data, and metadata. It takes the argument `all`. Example: 
18
+
19
+	tdnf clean all
20
+	Cleaning repos: photon photon-extras photon-updates lightwave
21
+	Cleaning up everything
22
+
23
+**distro-sync**: This command synchronizes the machine's RPMs with the latest version of all the packages in the repository. The following is an abridged example:
24
+
25
+	tdnf distro-sync
26
+
27
+	Upgrading:
28
+	zookeeper                             x86_64        3.4.8-2.ph1               3.38 M
29
+	yum                                   noarch        3.4.3-3.ph1               4.18 M
30
+
31
+	Total installed size: 113.01 M
32
+
33
+	Reinstalling:
34
+	zlib-devel                            x86_64        1.2.8-2.ph1             244.25 k
35
+	zlib                                  x86_64        1.2.8-2.ph1             103.93 k
36
+	yum-metadata-parser                   x86_64        1.1.4-1.ph1              57.10 k
37
+
38
+	Total installed size: 1.75 G
39
+
40
+	Obsoleting:
41
+	tftp                                  x86_64        5.2-3.ph1                32.99 k
42
+
43
+	Total installed size: 32.99 k
44
+	Is this ok [y/N]:
45
+
46
+**downgrade**: This command downgrades the package that you specify as an argument to the next lower package version. The following is an example: 
47
+
48
+	tdnf downgrade boost
49
+	Downgrading:
50
+	boost                                 x86_64        1.56.0-2.ph1              8.20 M
51
+	Total installed size: 8.20 M
52
+	Is this ok [y/N]:y
53
+	Downloading:
54
+	boost                                  2591470    100%
55
+	Testing transaction
56
+	Running transaction
57
+	Complete!
58
+
59
+To downgrade to a version lower than the next one, you must specify it by name, epoch, version, and release, all properly hyphenated. The following is an example: 
60
+
61
+	tdnf downgrade boost-1.56.0-2.ph1 
62
+
63
+**erase**: This command removes the package that you specify as an argument. The following is an example:
64
+
65
+	tdnf erase vim
66
+	Removing:
67
+	vim                                   x86_64        7.4-4.ph1                 1.94 M
68
+	Total installed size: 1.94 M
69
+	Is this ok [y/N]:
70
+
71
+You can also erase multiple packages: 
72
+
73
+	tdnf erase docker cloud-init
74
+
75
+**info**: This command displays information about packages. It can take the name of a package. Or it can take one of the following arguments: all, available, installed, extras, obsoletes, recent, upgrades. The following are examples:
76
+
77
+	tdnf info ruby
78
+	tdnf info obsoletes
79
+	tdnf info upgrades
80
+
81
+**install**: This command takes the name of a package as its argument. It then installs the package and its dependencies. The following are examples:
82
+
83
+	tdnf install kubernetes
84
+
85
+You can also install multiple packages: 
86
+
87
+	tdnf install python-curses lsof audit gettext chkconfig ntsysv bindutils 
88
+		 wget gawk irqbalance lvm2 cifs-utils c-ares distrib-compat
89
+	
90
+
91
+**list**: This command lists the packages of the package that you specify as the argument. The command can take one of the following arguments: all, available, installed, extras, obsoletes, recent, upgrades. 
92
+
93
+	tdnf list updates
94
+
95
+The list of packages might be long. To more easily view it, you can concatenate it into a text file, and then open the text file in a text editor: 
96
+
97
+	tdnf list all > pkgs.txt
98
+	vi pkgs.txt
99
+
100
+**makecache**: This command updates the cached binary metadata for all known repositories. The following is an example:
101
+
102
+	tdnf makecache
103
+	Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
104
+	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
105
+	Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
106
+	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
107
+	Metadata cache created.
108
+
109
+**provides**: This command finds the packages that provide the package that you supply as an argument. The following is an example: 
110
+
111
+	tdnf provides docker
112
+	docker-1.11.0-1.ph1.x86_64 : Docker
113
+	Repo     : photon
114
+	docker-1.11.0-1.ph1.x86_64 : Docker
115
+	Repo     : @System
116
+
117
+**reinstall**: This command reinstalls the packages that you specify. If some packages are unavailable or not installed, the command fails. The following is an example: 
118
+
119
+	tdnf reinstall docker kubernetes
120
+
121
+	Reinstalling:
122
+	kubernetes                            x86_64        1.1.8-1.ph1             152.95 M
123
+	docker                                x86_64        1.11.0-1.ph1             57.20 M
124
+
125
+	Total installed size: 210.15 M
126
+
127
+**remove**: This command removes a package. When removing a package, tdnf by default also removes dependencies that are no longer used if they were was installed by tdnf as a dependency without being explicitly requested by a user. You can modify the dependency removal by changing the `clean_requirements_on_remove` option in /etc/tdnf/tdnf.conf to `false`. 
128
+
129
+	tdnf remove packagename
130
+
131
+**search**: This command searches for the attributes of packages. The argument can be the names of packages. The following is an example: 
132
+
133
+	tdnf search docker kubernetes
134
+	docker : Docker
135
+	docker : Docker
136
+	docker-debuginfo : Debug information for package docker
137
+	docker : Docker
138
+	kubernetes : Kubernetes cluster management
139
+	kubernetes : Kubernetes cluster management
140
+	kubernetes-debuginfo : Debug information for package kubernetes
141
+	kubernetes : Kubernetes cluster management
142
+
143
+The argument of the search command can also be a keyword or a combination of keywords and packages: 
144
+
145
+	tdnf search terminal bash
146
+	rubygem-terminal-table : Simple, feature rich ascii table generation library
147
+	ncurses : Libraries for terminal handling of character screens
148
+	mingetty : A minimal getty program for virtual terminals
149
+	ncurses : Libraries for terminal handling of character screens
150
+	ncurses : Libraries for terminal handling of character screens
151
+	bash : Bourne-Again SHell
152
+	bash-lang : Additional language files for bash
153
+	bash-lang : Additional language files for bash
154
+	bash : Bourne-Again SHell
155
+	bash-debuginfo : Debug information for package bash
156
+	bash : Bourne-Again SHell
157
+	bash-lang : Additional language files for bash
158
+
159
+**upgrade**: This command upgrades the package or packages that you specify to an available higher version that tdnf can resolve. If the package is already the latest version, the command returns `Nothing to do`. The following is an example: 
160
+
161
+	tdnf upgrade boost
162
+
163
+	Upgrading:
164
+	boost                                 x86_64        1.60.0-1.ph1              8.11 M
165
+
166
+	Total installed size: 8.11 M
167
+	Is this ok [y/N]:y
168
+
169
+	Downloading:
170
+	boost                                  2785950    100%
171
+	Testing transaction
172
+	Running transaction
173
+
174
+	Complete!
175
+
176
+You can also run the `upgrade` command with the `refresh` option to update the cached metadata with the latest information from the repositories. The following example refreshes the metadata and then checks for a new version of tdnf but does not find one, so tdnf takes no action: 
177
+
178
+	tdnf upgrade tdnf --refresh
179
+	Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
180
+	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
181
+	Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
182
+	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
183
+	Nothing to do.
184
+
185
+**upgrade-to**: This command upgrades to the version of the package that you specify. EThe following is an example: 
186
+
187
+	tdnf upgrade-to ruby2.3
188
+
189
+The commands and options of tdnf are a subset of those of dnf. For more help with `tdnf` commands, see the [DNF documentation](https://media.readthedocs.org/pdf/dnf/latest/dnf.pdf).
0 190
\ No newline at end of file
1 191
new file mode 100644
... ...
@@ -0,0 +1,28 @@
0
+# Compiling C++ Code on the Minimal Version of Photon OS
1
+
2
+As a minimalist Linux run-time environment, the minimal version of Photon OS lacks the packages that you need to compile the code for a C++ program. For example, without the requisite packages, trying to compile the file containing the following code with the `gcc` command will generate errors: 
3
+
4
+    #include <stdio.h>
5
+    int main()
6
+    {
7
+    return 0;
8
+    }
9
+
10
+The errors look something like this: 
11
+
12
+    gcc test.c
13
+    -bash: gcc: command not found
14
+    tdnf install gcc -y
15
+    gcc test.c
16
+    test.c:1:19: fatal error: stdio.h: No such file or directory
17
+    compilation terminated.
18
+
19
+To enable the minimal version of Photon OS to preprocess, compile, assemble, and link C++ code, you must install the following packages as root with tdnf:
20
+
21
+* gcc
22
+* glibc-devel
23
+* binutils
24
+
25
+Here's the `tdnf` command to install these packages: 
26
+
27
+    tdnf install gcc glibc-devel binutils
0 28
\ No newline at end of file
1 29
new file mode 100644
... ...
@@ -0,0 +1,62 @@
0
+# Configuration Files and Repositories
1
+
2
+The main configuration files reside in /etc/tdnf/tdnf.conf. The configuration file appears as follows: 
3
+
4
+	cat /etc/tdnf/tdnf.conf
5
+	[main]
6
+	gpgcheck=1
7
+	installonly_limit=3
8
+	clean_requirements_on_remove=true
9
+	repodir=/etc/yum.repos.d
10
+	cachedir=/var/cache/tdnf
11
+
12
+The cache files for data and metadata reside in /var/cache/tdnf. 
13
+
14
+The following repositories appear in /etc/yum.repos.d/ with `.repo` file extensions:
15
+
16
+	ls /etc/yum.repos.d/
17
+	lightwave.repo
18
+	photon-extras.repo
19
+	photon-iso.repo
20
+	photon-updates.repo
21
+	photon.repo 
22
+
23
+
24
+You can list the the repositories by using the `tdnf repolist` command. Tdnf filters the results with `enabled`, `disabled`, and `all`. Running the command without specifying an argument returns the enabled repositories:  
25
+
26
+	tdnf repolist
27
+	repo id             repo name                               status
28
+	photon-updates      VMware Photon Linux 2.0(x86_64)Updates  enabled
29
+	photon-extras       VMware Photon Extras 2.0(x86_64)        enabled
30
+	photon              VMware Photon Linux 2.0(x86_64)         enabled
31
+
32
+
33
+The `photon-iso.repo`, however, does not appear in the list of repositories because it is unavailable on the virtual machine from which these examples are taken. The `photon-iso.repo` is the default repository and it points to /media/cdrom. The `photon-iso.repo` appears as follows: 
34
+
35
+	cat /etc/yum.repos.d/photon-iso.repo
36
+	[photon-iso]
37
+	name=VMWare Photon Linux 2.0(x86_64)
38
+	baseurl=file:///mnt/cdrom/RPMS
39
+	gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
40
+	gpgcheck=1
41
+	enabled=0
42
+	skip_if_unavailable=True
43
+
44
+The local cache is populated with data from the repository: 
45
+
46
+	ls -l /var/cache/tdnf/photon
47
+	total 8
48
+	drwxr-xr-x 2 root root 4096 May 18 22:52 repodata
49
+	d-wxr----t 3 root root 4096 May  3 22:51 rpms
50
+
51
+You can clear the cache to help troubleshoot a problem, but doing so might slow the performance of `tdnf` until the cache becomes repopulated with data. To clear the cache, use the following command: 
52
+
53
+	tdnf clean all
54
+	Cleaning repos: photon photon-extras photon-updates lightwave
55
+	Cleaning up everything
56
+
57
+The command purges the repository data from the cache: 
58
+
59
+	ls -l /var/cache/tdnf/photon
60
+	total 4
61
+	d-wxr----t 3 root root 4096 May  3 22:51 rpms
0 62
\ No newline at end of file
1 63
new file mode 100644
... ...
@@ -0,0 +1,45 @@
0
+# Configuring Network Interfaces
1
+
2
+Network configuration files for systemd-networkd reside in /etc/systemd/network and /usr/lib/systemd/network. Example:
3
+
4
+	root@photon-rc [ ~ ]# ls /etc/systemd/network/
5
+	99-dhcp-en.network
6
+
7
+By default, when Photon OS starts, it creates a DHCP network configuration file, or rule, which appears in /etc/systemd/network, the highest priority directory for network configuration files with the lowest priority filename:
8
+
9
+	cat /etc/systemd/network/99-dhcp-en.network
10
+	[Match]
11
+	Name=e*
12
+
13
+	[Network]
14
+	DHCP=yes
15
+
16
+Network configuration files can also appear in the system network directory, /usr/lib/systemd/network, as the results of the following search illustrate:
17
+
18
+	root@photon-rc [ ~ ]# updatedb
19
+	root@photon-rc [ ~ ]# locate systemd/network
20
+	/etc/systemd/network
21
+	/etc/systemd/network/99-dhcp-en.network
22
+	/usr/lib/systemd/network
23
+	/usr/lib/systemd/network/80-container-host0.network
24
+	/usr/lib/systemd/network/80-container-ve.network
25
+	/usr/lib/systemd/network/99-default.link
26
+	root@photon-rc [ ~ ]#
27
+
28
+As you can see, the /usr/lib/systemd/network directory contains several network configuration files. Photon OS applies the configuration files in the [lexicographical order](https://en.wikipedia.org/wiki/Lexicographical_order) specified by the file names without regard for the network configuration directory in which the file resides unless the file name is the same. Photon OS processes files with identical names by giving precedence to files in the /etc directory over the other directory. Thus, the settings in /etc/systemd/network override those in /usr/lib/systemd/network. Once Photon OS matches an interface in a file, Photon OS ignores the interface if it appears in files processed later in the lexicographical order. 
29
+
30
+Each .network file contains a matching rule and a configuration that Photon OS applies when a device matches the rule. You set the matching rule and the configuration as sections containing vertical sets of key-value pairs according to the information at https://www.freedesktop.org/software/systemd/man/systemd.network.html. 
31
+
32
+To configure Photon OS to handle a networking use case, such as setting a static IP address or adding a name server, you create a configuration file with a `.network` extension and place it in the /etc/systemd/network directory.
33
+
34
+After you create a network configuration file with a `.network` extension, you must run the `chmod` command to set the new file's mode bits to `644`. Example: 
35
+
36
+    chmod 644 10-static-en.network
37
+
38
+For Photon OS to apply the new configuration, you must restart the `systemd-networkd` service by running the following command: 
39
+
40
+	systemctl restart systemd-networkd
41
+
42
+For information about network configuration files, their processing order, and their matching rules, sections, and keys, see https://www.freedesktop.org/software/systemd/man/systemd.network.html.
43
+
44
+For information about creating virtual network device files (`.netdev`), see https://www.freedesktop.org/software/systemd/man/systemd.netdev.html.
0 45
\ No newline at end of file
1 46
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+# Controlling Services
1
+
2
+To control services on Photon OS, use `systemctl` command. 
3
+
4
+For example, instead of running the `/etc/init.d/ssh` script to stop and start the OpenSSH server on a init.d-based Linux system, run the following `systemctl` commands on Photon OS: 
5
+
6
+	systemctl stop sshd
7
+	systemctl start sshd
8
+
9
+The systemctl tool includes a range of commands and options for inspecting and controlling the state of systemd and the service manager. For more information, see the [systemctl man page](https://www.freedesktop.org/software/systemd/man/systemctl.html).
0 10
new file mode 100644
... ...
@@ -0,0 +1,36 @@
0
+# Creating a Stand-Alone Photon Machine with cloud-init
1
+
2
+Cloud-init can customize a Photon OS virtual machine by using the `nocloud` data source. The nocloud data source bundles the cloud-init metadata and user data into a ISO that acts as a seed when you boot the machine. This seed.iso delivers the metadata and the user data without requiring a network connection. 
3
+
4
+Here's how customize a Photon OS VM with a nocloud data source:
5
+
6
+First, create the metadata file with the following lines in the [YAML](http://www.yaml.org/start.html) format and name it `meta-data`:
7
+
8
+	instance-id: iid-local01
9
+	local-hostname: cloudimg
10
+
11
+Second, create the user data file with the following lines in YAML and name it user-data:
12
+
13
+	#cloud-config
14
+	hostname: testhost
15
+	packages:
16
+	 - vim
17
+
18
+Third, generate the ISO that will serve as the seed; the ISO must have the volume ID set to `cidata`. In this example, the ISO is generated on an Ubuntu 14.04 computer containing the files named `meta-data` and `user-data` in the local directory: 
19
+
20
+	genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
21
+
22
+The ISO now appears in the current directory: 
23
+
24
+	steve@ubuntu:~$ ls
25
+	meta-data seed.iso user-data
26
+
27
+Optionally, you can check the ISO that you generated on Ubuntu by transferring the ISO to the root directory of your Photon OS machine and then running the following command: 
28
+
29
+	cloud-init --file seed.iso --debug init
30
+
31
+After running the cloud-init command above, check the cloud-init log file: 
32
+
33
+	more /var/log/cloud-init.log
34
+
35
+Finally, attach the ISO to the Photon OS virtual machine as a CD-ROM and reboot it so that the changes specified by seed.iso take effect. In this case, cloud-init sets the hostname and adds the vim package.
0 36
\ No newline at end of file
1 37
new file mode 100644
... ...
@@ -0,0 +1,32 @@
0
+# Creating a Startup Service
1
+
2
+Use `systemd` to create a sratup service. 
3
+
4
+The following example shows you how to create a systemd startup service that changes the maximum transmission unit (MTU) of the default Ethernet connection, `eth0`.
5
+
6
+1. Concatenate the following block of code into a file:
7
+	
8
+	
9
+```
10
+cat << EOF >> /lib/systemd/system/eth0.service
11
+	[Unit]
12
+	Description=Network interface initialization
13
+	After=local-fs.target network-online.target network.target
14
+	Wants=local-fs.target network-online.target network.target
15
+
16
+	[Service]
17
+	ExecStart=/bin/ifconfig eth0 mtu 1460 up
18
+	Type=oneshot
19
+
20
+	[Install]
21
+	WantedBy=multi-user.target
22
+	EOF
23
+```
24
+
25
+1. Set the service to auto-start when the system boots:
26
+	
27
+```
28
+cd /lib/systemd/system/multi-user.target.wants/
29
+	ln -s ../eth0.service eth0.service
30
+```
31
+
0 32
new file mode 100644
... ...
@@ -0,0 +1,77 @@
0
+# Customizing a Photon OS Machine on EC2
1
+
2
+This section illustrates how to upload an `ami` image of Photon OS to Amazon Elastic Compute Cloud (EC2) and customize the Photon OS machine by using cloud-init with an EC2 data source. The Amazon machine image version of Photon OS is available as a free download on Bintray:
3
+
4
+	https://bintray.com/vmware/photon/
5
+
6
+The cloud-init service is commonly used on EC2 to configure the cloud instance of a Linux image. On EC2, for example, cloud-init typically sets the `.ssh/authorized_keys` file to let you log in with a private key from another computer--that is, a computer besides the workstation that you are already using to connect with the Amazon cloud. The cloud-config user-data file that appears in the following example contains abridged SSH authorized keys to show you how to set them. 
7
+
8
+Working with EC2 requires Amazon accounts for both AWS and EC2 with valid payment information. If you execute the following examples, you will be charged by Amazon. You will need to replace the `<placeholders>` for access keys and other account information in the examples with your account information. 
9
+
10
+The following code assumes you have installed and set up the Amazon AWS CLI and the EC2 CLI tools, including `ec2-ami-tools`. See [Installing the AWS Command Line Interface](http://docs.aws.amazon.com/cli/latest/userguide/installing.html) and [Setting Up the Amazon EC2 Command Line Interface Tools on Linux](http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/set-up-ec2-cli-linux.html). Also see [Setting Up the AMI Tools](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-up-ami-tools.html). 
11
+
12
+EC2 requires an SSH key and an RSA certificate. The code in the examples  assumes that you have created SSH keys as well as an RSA user signing certificate and its corresponding private RSA key file.  
13
+
14
+Here's a code example that shows how to upload the Photon OS `.ami` image to the Amazon cloud and configure it with cloud-init. The correct virtualization type for Photon OS is `hvm`.   
15
+
16
+	$ mkdir bundled
17
+	$ tar -zxvf ./photon-ami.tar.gz 
18
+	$ ec2-bundle-image -c ec2-certificate.pem -k ec2-privatekey.pem -u <EC2 account id>  --arch x86_64 --image photon-ami.raw --destination ./bundled/
19
+	$ aws s3 mb s3://<bucket-name>
20
+	$ ec2-upload-bundle --manifest ./bundled/photon-ami.manifest.xml --bucket <bucket-name> --access-key <Account Access Key> --secret-key <Account Secret key>
21
+	$ ec2-register <bucket-name>/photon-ami.manifest.xml --name photon-ami --architecture x86_64 --virtualization-type hvm
22
+
23
+In the following command, the `--user-data-file` option instructs cloud-init to import the cloud-config data in `user-data.txt`. The next command assumes you have created the keypair called `mykeypair` and the security group photon-sg as well as uploaded the user-data.txt file; see the EC2 documentation.
24
+
25
+    $ ec2-run-instances <ami-ID> --instance-type m3.medium -g photon-sg --key mykeypair --user-data-file user-data.txt
26
+
27
+You can now describe the instance to see its ID: 
28
+
29
+	$ ec2-describe-instances
30
+
31
+And you can run the following command to obtain its public IP address, which you can use to connect to the instance with SSH:
32
+
33
+	$ aws ec2 describe-instances --instance-ids <instance-id> --query 'Reservations[*].Instances[*].PublicIpAddress' --output=text
34
+	$ ec2-describe-images
35
+
36
+**Important**: When you are done, run the following commands to terminate the machine. Because Amazon charges you while the host is running, make sure to shut it down:  
37
+
38
+	$ ec2-deregister <ami-image-identifier>
39
+	$ ec2-terminate-instances <instance-id>
40
+
41
+Here are the contents of the user-data.txt file that cloud-init applies to the machine the first time that it boots up in the cloud: 
42
+
43
+    #cloud-config
44
+    hostname: photon-on-01
45
+    groups:
46
+    - cloud-admins
47
+    - cloud-users
48
+    users:
49
+    - default
50
+    - name: photonadmin
51
+       gecos: photon test admin user
52
+       primary-group: cloud-admins
53
+       groups: cloud-users
54
+       lock-passwd: false
55
+       passwd: vmware
56
+    - name: photonuser
57
+       gecos: photon test user
58
+       primary-group: cloud-users
59
+       groups: users
60
+       passwd: vmware
61
+    packages:
62
+    - vim
63
+	ssh_authorized_keys:
64
+	 - ssh-rsa MIIEogIBAAKCAQEAuvHKAjBhpwuomcUTpIzJWRJAe71JyBgAWrwqyN1Mk5N+c9X5
65
+	Ru2fazFA7WxQSD1KyTEvcuf8JzdBfrEJ0v3/nT2x63pvJ8fCl6HRkZtHo8zRu8vY
66
+	KYTZS/sdvM/ruubHfq1ldRpgtYSqbkykoe6PCQIDAQABAoIBAEgveQtjVzHDhLTr
67
+	rmwJmO316ERfkQ/chLaElhi9qwYJG/jqlNIISWFyztqD1b3fxU6m5MOBIujh7Xpg
68
+	... ec3test@example.com
69
+
70
+Now check the cloud-init output log file on EC2 at `/var/log/cloud-init-output.log`. 
71
+
72
+For more information on using cloud-init user data on EC2, see [Running Commands on Your Linux Instance at Launch](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html).
73
+
74
+An article on the Photon OS GitHub wiki demonstrates how to get Photon OS up and running on EC2 and run a containerized application in the Docker engine. See [Running Photon OS on Amazon Elastic Cloud Compute](Running-Photon-OS-on-Amazon-Elastic-Cloud-Compute.md).
75
+
76
+With Photon OS, you can also build cloud images on Google Compute Engine and other cloud providers; see [Compatible Cloud Images](cloud-images.md).
0 77
\ No newline at end of file
1 78
new file mode 100644
... ...
@@ -0,0 +1,27 @@
0
+# Default Firewall Settings
1
+
2
+The design of Photon OS emphasizes security. On the minimal and full versions of Photon OS, the default security policy turns on the firewall and drops packets from external interfaces and  applications. As a result, you might need to add rules to iptables to permit forwarding, allow protocols like HTTP, and open ports. In other words, you must configure the firewall for your applications and requirements. 
3
+
4
+The default iptables settings on the full version look like this:
5
+
6
+    iptables --list
7
+    Chain INPUT (policy DROP)
8
+    target     prot opt source               destination
9
+    ACCEPT     all  --  anywhere             anywhere
10
+    ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
11
+    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh
12
+
13
+    Chain FORWARD (policy DROP)
14
+    target     prot opt source               destination
15
+
16
+    Chain OUTPUT (policy DROP)
17
+    target     prot opt source               destination
18
+    ACCEPT     all  --  anywhere             anywhere
19
+
20
+To find out how to adjust the settings, see the man page for iptables. 
21
+
22
+Although the default iptables policy accepts SSH connections, the `sshd` configuration file on the full version of Photon OS is set to reject SSH connections. See [Permitting Root Login with SSH](#permitting-root-login-with-ssh).
23
+
24
+If you are unable to ping a Photon OS machine, one of the first things you should do is check the firewall rules. Do they allow connectivity for the port and protocol in question? You can supplement the `iptables` commands by using `lsof` commands to, for instance, see the processes listening on ports: 
25
+
26
+    lsof -i -P -n
0 27
\ No newline at end of file
1 28
new file mode 100644
... ...
@@ -0,0 +1,31 @@
0
+# Default Permissions and umask
1
+
2
+The umask on Photon OS is set to `0027`.
3
+
4
+When you create a new file with the `touch` command as root, the default on Photon OS is to set the permissions to `0640`--which translates to read-write for user, read for group, and no access for others. Here's an example: 
5
+
6
+    touch newfile.md
7
+    stat newfile.md
8
+      File: 'newfile.md'
9
+      Size: 0               Blocks: 0          IO Block: 4096   regular empty file
10
+    Device: 801h/2049d      Inode: 316454      Links: 1
11
+    Access: (0640/-rw-r-----)  Uid: (    0/    root)   Gid: (    0/    root)
12
+
13
+When you create a directory as root, Photon OS sets the permissions to `0750`:
14
+
15
+    mkdir newdir
16
+    stat newdir
17
+      File: 'newdir'
18
+      Size: 4096            Blocks: 8          IO Block: 4096   directory
19
+    Device: 801h/2049d      Inode: 316455      Links: 2
20
+    Access: (0750/drwxr-x---)  Uid: (    0/    root)   Gid: (    0/    root)
21
+
22
+Because the `mkdir` command uses the umask to modify the permissions placed on newly created files or directories, you can see `umask` at work in the permissions of the new directory: Its default permissions are set at 0750 after the umask subtracts 0027 from the full set of open permissions, 0777.
23
+
24
+Similarly, a new file begins as 0666, which you could see if you were to set umask to 0000. But because umask is set by default to 0027, a new file's permissions are set to 0640. 
25
+
26
+So be aware of the default permissions on the directories and files that you create. Some system services and applications might require permissions other than the default. The systemd network service, for example, requires user-defined configuration files to be set to 644, not the default of 640. Thus, after you create a network configuration file with a `.network` extension, you must run the `chmod` command to set the new file's mode bits to `644`. Example: 
27
+
28
+    chmod 644 10-static-en.network 
29
+
30
+For more information on permissions, see the man pages for `stat`, `umask`, and `acl`.
0 31
\ No newline at end of file
1 32
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+# Default Security Policy of Photon OS
1
+
2
+-   [Default Firewall Settings](default-firewall-settings.md)
3
+-   [Default Permissions and umask](default-permissions-and-umask.md)
0 4
\ No newline at end of file
1 5
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+# Looking at the Differences Between the Minimal and the Full Version
1
+
2
+The minimal version of Photon OS contains around 50 packages. As it is installed, the number of packages increases to nearly 100 to fulfill dependencies. The full version of Photon OS adds several hundred packages to those in the minimal version to deliver a more fully featured operating system. 
3
+
4
+You can view a list of the packages that appear in the minimal version by examining the following file: 
5
+
6
+[https://github.com/vmware/photon/blob/master/common/data/packages_minimal.json](https://github.com/vmware/photon/blob/master/common/data/packages_minimal.json)
7
+
8
+You can view a list of the packages that appear in the full version by examining the following file: 
9
+
10
+[https://github.com/vmware/photon/blob/master/common/data/packages_full.json](https://github.com/vmware/photon/blob/master/common/data/packages_full.json)
11
+
12
+If the minimal or the full version of Photon OS does not contain a package that you want, you can install it with tdnf, which appears in both the minimal and full versions of Photon OS by default. In the full version of Photon OS, you can also install packages by using yum. 
13
+
14
+One notable difference between the two versions of Photon OS pertains to OpenJDK, the package that contains not only the Java runtime environment (`openjre`) but also the Java compiler (`javac`). The OpenJDK package appears in the full but not the minimal version of Photon OS. 
15
+
16
+To add support for Java programs to the minimal version of Photon OS, install the Java packages and their dependencies by using the following command: 
17
+
18
+	tdnf install openjdk
19
+	Installing:
20
+	openjre 	x86_64    1.8.0.92-1.ph1    95.09 M
21
+	openjdk 	x86_64    1.8.0.92-1.ph1    37.63 M
22
+
23
+**NOTE:** `openjdk` and `openjre` are available as openjdk8 and openjre8 in Photon OS 2.0
24
+
25
+For more information about `tdnf`, see [Tiny DNF for Package Management](tiny-dnf-for-package-management.md)
0 26
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+# Disabling the Photon OS httpd.service 
1
+
2
+If your application or appliance includes its own HTTP server, you must turn off and disable the HTTP server that comes with Photon OS so that it does not conflict with your own HTTP server. 
3
+
4
+To stop it and disable it, run the following commands as root: 
5
+
6
+	
7
+```
8
+systemctl stop httpd.service
9
+systemctl disable httpd.service
10
+```
0 11
new file mode 100644
... ...
@@ -0,0 +1,43 @@
0
+# Disabling TLS 1.0 to Improve Transport Layer Security
1
+
2
+Photon OS includes GnuTLS to help secure the transport layer. [GnuTLS](http://www.gnutls.org/) is a library that implements the SSL and TLS protocols to secure communications. 
3
+
4
+On Photon OS, SSL 3.0, which contains a known vulnerability, is disabled by default. 
5
+
6
+However, TLS 1.0, which also contains known vulnerabilities, is enabled by default.
7
+
8
+To turn off TLS 1.0, make a directory named `/etc/gnutls` and then in `/etc/gnutls` create a file named `default-priorities`. In the `default-priorities` file, specify GnuTLS priority strings that remove TLS 1.0 and SSL 3.0 but retain TLS 1.1 and TLS 1.2.
9
+
10
+After adding a new `default-priorities` file or after modifying it, you must restart all applications, including SSH, with an open TLS session for the changes to take effect.  
11
+
12
+Here is an example of a `default-priorities` file that contains GnuTLS priorities to disable TLS 1.0 and SSL 3.0:  
13
+
14
+	cat /etc/gnutls/default-priorities
15
+	SYSTEM=NONE:!VERS-SSL3.0:!VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL
16
+
17
+This example priority string imposes system-specific policies. The NONE keyword means that no algorithms, protocols, or compression methods are enabled, so that you can enable specific versions individually later in the string. The example priority string then specifies that SSL version 3.0 and TLS version 1.0 be removed, as marked by the exclamation point. The priority string then enables, as marked by the plus sign, versions 1.1 and 1.2 of TLS. The cypher is AES-128-CBC. The key exchange is RSA. The MAC is SHA1. And the compression algorithm is COMP-NULL.
18
+
19
+On Photon OS, you can verify the system-specific policies in the `default-priorities` file as follows. 
20
+
21
+Concatenate the `default-priorities` file to check its contents: 
22
+
23
+	root@photon-rc [ ~ ]# cat /etc/gnutls/default-priorities
24
+	SYSTEM=NONE:!VERS-SSL3.0:!VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL
25
+
26
+Run the following command to check the protocols that are enabled for the system: 
27
+
28
+	root@photon-rc [ /etc/gnutls ]# gnutls-cli --priority @SYSTEM -l
29
+	Cipher suites for @SYSTEM
30
+	TLS_RSA_AES_128_CBC_SHA1                                0x00, 0x2f      SSL3.0
31
+
32
+	Certificate types: none
33
+	Protocols: VERS-TLS1.1, VERS-TLS1.2
34
+	Compression: COMP-NULL
35
+	Elliptic curves: none
36
+	PK-signatures: none
37
+
38
+For information about the GnuTLS priority strings, see [https://gnutls.org/manual/html_node/Priority-Strings.html](https://gnutls.org/manual/html_node/Priority-Strings.html).
39
+
40
+For information about the vulnerability in SSL 3.0, see [SSL 3.0 Protocol Vulnerability and POODLE Attack](https://www.us-cert.gov/ncas/alerts/TA14-290A).
41
+
42
+For information about the vulnerabilities in TLS 1.0, see [Guidelines for the Selection, Configuration, and Use of Transport Layer Security (TLS) Implementations](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-52r1.pdf).
0 43
new file mode 100644
... ...
@@ -0,0 +1,23 @@
0
+# Docker Containers
1
+
2
+Photon OS includes the open source version of Docker. With Docker, Photon OS becomes a Linux run-time host for containers--that is, a Linux cloud container. A container is a process that runs on the Photon OS host with its own isolated application, file system, and networking.
3
+
4
+On Photon OS, the Docker daemon is enabled by default. To view the status of the daemon, run this command: 
5
+
6
+	systemctl status docker
7
+
8
+Docker is loaded and running by default on the full version of Photon OS. On the minimal version, it is loaded but not running by default, so you have to start it: 
9
+
10
+	systemctl start docker
11
+
12
+To obtain information about Docker, run this command as root: 
13
+
14
+	docker info
15
+
16
+After you make sure that docker is enabled and started, you can, for example, run the following docker command as root to create a container running Ubuntu 14.04 with an interactive terminal shell: 
17
+
18
+	docker run -i -t ubuntu:14.04 /bin/bash
19
+
20
+Photon OS also enables you to run a docker container that, in turn, runs Photon OS: 
21
+
22
+	docker run -i -t photon /bin/bash
0 23
new file mode 100644
... ...
@@ -0,0 +1,37 @@
0
+# Examining the Packages in the SPECS Directory on Github
1
+
2
+The SPECS directory of the GitHub website for Photon OS contains all the packages that can appear in Photon OS repositories. The following is the path to the SPECS directory :  
3
+
4
+`https://github.com/vmware/photon/tree/master/SPECS`
5
+
6
+To see the version of a package, in the SPECS directory, click the name of the subdirectory of the package that you want to examine, and then click the `.spec` filename in the subdirectory. 
7
+
8
+For example, the version of OpenJDK, which contains the openjre package that installs the Java class library and the javac Java compiler appears as follows:
9
+
10
+```
11
+%define _use_internal_dependency_generator 0
12
+Summary:	OpenJDK 
13
+Name:		openjdk
14
+Version:	1.8.0.72
15
+Release:	1%{?dist}
16
+License:	GNU GPL
17
+URL:		https://openjdk.java.net
18
+Group:		Development/Tools
19
+Vendor:		VMware, Inc.
20
+Distribution:   Photon
21
+AutoReqProv: 	no
22
+Source0:	http://anduin.linuxfromscratch.org/files/BLFS/OpenJDK-%{version}/OpenJDK-%{version}-x86_64-bin.tar.xz
23
+%define sha1 OpenJDK=0c705d7b13f4e22611d2da654209f469a6297f26
24
+%description
25
+The OpenJDK package installs java class library and javac java compiler. 
26
+
27
+%package	-n openjre
28
+Summary:	Jave runtime environment
29
+AutoReqProv: 	no
30
+%description	-n openjre
31
+It contains the libraries files for Java runtime environment
32
+#%global __requires_exclude ^libgif.*$
33
+#%filter_from_requires ^libgif.*$...
34
+```
35
+
36
+
0 37
new file mode 100644
... ...
@@ -0,0 +1,61 @@
0
+# Inspecting the Status of Network Links with `networkctl`
1
+
2
+The `networkctl` command shows information about network connections that helps you configure networking services and troubleshoot networking problems. You can, for example, progressively add options and arguments to the `networkctl` command to move from general information about network connections to specific information about a network connection. 
3
+
4
+Running `networkctl` without options defaults to the list command:  
5
+
6
+	networkctl
7
+	IDX LINK             TYPE               OPERATIONAL SETUP
8
+	  1 lo               loopback           carrier     unmanaged
9
+	  2 eth0             ether              routable    configured
10
+	  3 docker0          ether              routable    unmanaged
11
+	 11 vethb0aa7a6      ether              degraded    unmanaged
12
+	 4 links listed.
13
+
14
+Running `networkctl` with the status command displays information that looks like this; you can see that there are active network links with IP addresses for not only the Ethernet connection but also a Docker container. 
15
+
16
+	root@photon-rc [ ~ ]# networkctl status
17
+	*      State: routable
18
+	     Address: 198.51.100.131 on eth0
19
+	              172.17.0.1 on docker0
20
+	              fe80::20c:29ff:fe55:3ca6 on eth0
21
+	              fe80::42:f0ff:fef7:bd81 on docker0
22
+	              fe80::4c84:caff:fe76:a23f on vethb0aa7a6
23
+	     Gateway: 198.51.100.2 on eth0
24
+	         DNS: 198.51.100.2
25
+
26
+You can then add a network link, such as the Ethernet connection, as the argument of the status command to show specific information about the link: 
27
+
28
+	root@photon-rc [ ~ ]# networkctl status eth0
29
+	* 2: eth0
30
+	       Link File: /usr/lib/systemd/network/99-default.link
31
+	    Network File: /etc/systemd/network/99-dhcp-en.network
32
+	            Type: ether
33
+	           State: routable (configured)
34
+	            Path: pci-0000:02:01.0
35
+	          Driver: e1000
36
+	      HW Address: 00:0c:29:55:3c:a6 (VMware, Inc.)
37
+	             MTU: 1500
38
+	         Address: 198.51.100.131
39
+	                  fe80::20c:29ff:fe55:3ca6
40
+	         Gateway: 198.51.100.2
41
+	             DNS: 198.51.100.2
42
+	        CLIENTID: ffb6220feb00020000ab116724f520a0a77337
43
+
44
+And you can do the same thing with the Docker container: 
45
+
46
+	networkctl status docker0
47
+	* 3: docker0
48
+	       Link File: /usr/lib/systemd/network/99-default.link
49
+	    Network File: n/a
50
+	            Type: ether
51
+	           State: routable (unmanaged)
52
+	          Driver: bridge
53
+	      HW Address: 02:42:f0:f7:bd:81
54
+	             MTU: 1500
55
+	         Address: 172.17.0.1
56
+	                  fe80::42:f0ff:fef7:bd81
57
+
58
+In the example above, it is OK that the state of the Docker container is unmanaged; Docker handles managing the networking for the containers without using systemd-resolved or systemd-networkd. Instead, Docker manages the container's connection by using its bridge drive.
59
+
60
+For more information about `networkctl` commands and options, see https://www.freedesktop.org/software/systemd/man/networkctl.html.
0 61
\ No newline at end of file
1 62
new file mode 100644
... ...
@@ -0,0 +1,52 @@
0
+# Installing Sendmail
1
+
2
+Before you install Sendmail, you should set the fully qualified domain name (FQDN) of your Photon OS machine.
3
+
4
+Neither the full nor the minimal version of Photon OS installs Sendmail by default. When you install Sendmail, it provides Photon OS with a systemd service file that typically enables Sendmail. If, however, the service is not enabled after installation, you must enable it. 
5
+
6
+Sendmail resides in the Photon extras repository. You can install it with `tdnf` after setting the machine's FQDN. Here's how: 
7
+
8
+First, check whether the machine's FQDN is set by running the `hostnamectl status` command:  
9
+
10
+         hostnamectl status
11
+       Static hostname: photon-d9ee400e194e
12
+             Icon name: computer-vm
13
+               Chassis: vm
14
+            Machine ID: a53b414142f944319bd0c8df6d811f36
15
+               Boot ID: 1f75baca8cc249f79c3794978bd82977
16
+        Virtualization: vmware
17
+      Operating System: VMware Photon/Linux
18
+                Kernel: Linux 4.4.8
19
+          Architecture: x86-64
20
+
21
+In the results above, the FQDN is not set; the Photon OS machine has only a short name. If the FQDN were set, the hostname would be in its full form, typically with a domain name. 
22
+
23
+If the machine does not have an FQDN, set one by running `hostnamectl set-hostname new-name`, replacing `new-name` with the FQDN that you want. Example:  
24
+
25
+     hostnamectl set-hostname photon-d9ee400e194e.corp.example.com
26
+
27
+The `hostnamectl status` command now shows that the machine has an FQDN: 
28
+
29
+    root@photon-d9ee400e194e [ ~ ]# hostnamectl status
30
+       Static hostname: photon-d9ee400e194e.corp.example.com
31
+             Icon name: computer-vm
32
+               Chassis: vm
33
+            Machine ID: a53b414142f944319bd0c8df6d811f36
34
+               Boot ID: 1f75baca8cc249f79c3794978bd82977
35
+        Virtualization: vmware
36
+      Operating System: VMware Photon/Linux
37
+                Kernel: Linux 4.4.8
38
+          Architecture: x86-64
39
+
40
+Next, install Sendmail: 
41
+
42
+    tdnf install sendmail
43
+
44
+Make sure it is enabled: 
45
+
46
+    systemctl status sendmail
47
+
48
+Enable Sendmail if it's disabled and then start it: 
49
+
50
+    systemctl enable sendmail
51
+    systemctl start sendmail
0 52
\ No newline at end of file
1 53
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+# Installing the Packages for tcpdump and netcat with tdnf
1
+
2
+The minimal version of Photon OS leaves out several useful networking tools to keep the operating system lean. Tcpdump, for example, is absent in the minimal version but available in the repository. The minimal version does, however, include the iproute2 tools by default. 
3
+
4
+Tcpdump captures and analyzes packets on a network interface. On Photon OS, you install tcpdump and its accompanying package libpcap, a C/C++ library for capturing network traffic, by using tdnf, Photon's command-line package manager: 
5
+
6
+	tdnf install tcpdump
7
+
8
+Netcat, a tool for sending data over network connections with TCP or UDP, appears in neither the minimal nor the full version of Photon OS. But since netcat furnishes powerful options for analyzing, troubleshooting, and debugging network connections, you might want to install it. To do so, run the following command: 
9
+
10
+	tdnf install netcat
0 11
\ No newline at end of file
1 12
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+# Kubernetes
1
+
2
+The full version of Photon OS includes Kubernetes so you can manage clusters of containers. For more information, see [Running Kubernetes on Photon OS](kubernetes.md).
0 3
new file mode 100644
... ...
@@ -0,0 +1,13 @@
0
+# Managing Services with systemd
1
+
2
+Photon OS manages services with `systemd`. By using `systemd`, Photon OS adopts a contemporary Linux standard to bootstrap the user space and concurrently start services. This is an architecture that differs from traditional Linux systems such as SUSE Linux Enterprise Server. 
3
+
4
+A traditional Linux system contains an initialization system called SysVinit. With SLES 11, for instance, the SysVinit-style init programs control how the system starts up and shuts down. Init implements system runlevels. A SysVinit runlevel defines a state in which a process or service runs. 
5
+
6
+In contrast to a SysVinit system, `systemd` defines no such runlevels. Instead, `systemd` uses a dependency tree of targets to determine which services to start when. Combined with the declarative nature of `systemd` commands, `systemd` targets reduce the amount of code needed to run a command, leaving you with code that is easier to maintain and probably faster to execute. For an overview of `systemd`, see [systemd System and Service Manager](https://www.freedesktop.org/wiki/Software/systemd/) and the [man page for systemd](https://www.freedesktop.org/software/systemd/man/systemd.html).
7
+
8
+On Photon OS, you must manage services with systemd and `systemctl`, its command-line utility for inspecting and controlling the system, and not the deprecated commands of `init.d`. 
9
+
10
+For more information, see the index of all the systemd man pages, including systemctl, at the following URL: 
11
+
12
+[https://www.freedesktop.org/software/systemd/man/](https://www.freedesktop.org/software/systemd/man/)
0 13
\ No newline at end of file
1 14
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+# Managing the Network Configuration
1
+
2
+The network service, which is enabled by default, starts when the system boots. You manage the network service by using systemd commands, such as systemd-networkd, systemd-resolvd, and networkctl. You can check its status of the network service by running the following command: 
3
+
4
+	systemctl status systemd-networkd
5
+
6
+Here is a healthy result of the command: 
7
+
8
+	* systemd-networkd.service - Network Service
9
+	   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
10
+	   Active: active (running) since Fri 2016-04-29 15:08:51 UTC; 6 days ago
11
+	     Docs: man:systemd-networkd.service(8)
12
+	 Main PID: 291 (systemd-network)
13
+	   Status: "Processing requests..."
14
+	   CGroup: /system.slice/systemd-networkd.service
15
+	           `-291 /lib/systemd/systemd-networkd
16
+
17
+Because Photon OS relies on systemd to manage services, you should employ the systemd suite of commands, not deprecated init.d commands or other deprecated commands, to manage networking. 
0 18
\ No newline at end of file
1 19
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+# Migrating Scripts to systemd
1
+
2
+Although `systemd` maintains compatibility with `init.d` scripts, as a best practice, you must adapt the scripts that you want to run on Photon OS to `systemd` to avoid potential problems. 
3
+
4
+Such a conversion standardizes the scripts, reduces the footprint of your code, makes the scripts easier to read and maintain, and improves their robustness on a `systemd` system.
0 5
\ No newline at end of file
1 6
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+# Mounting a Network File System
1
+
2
+To mount a network file system, Photon OS requires nfs-utils. The nfs-utils package contains the daemon, userspace server, and client tools for the kernel Network File System, or NFS. The tools include mount.nfs, umount.nfs, and showmount. 
3
+
4
+The nfs-utils package is installed by default in the full version of Photon OS but not in the minimal version. To install nfs-utils in the minimal version, run the following command as root: 
5
+
6
+	tdnf install nfs-utils
7
+
8
+For instructions on how to use nfs-utils to share files over a network, see [Photon OS nfs-utils](nfs-utils.md).
0 9
\ No newline at end of file
1 10
new file mode 100644
... ...
@@ -0,0 +1,239 @@
0
+# Photon Network Manager Command-line Interface (netmgr)
1
+
2
+For locally logged-on users, Photon OS provides a command line interface to manage network configuration of the system.
3
+
4
+- [Setup Steps](#setup-steps)
5
+- [Syntax](#syntax)
6
+- [Network Manager CLI](#network-manager-cli)
7
+
8
+# Setup Steps
9
+
10
+The netmgr tool is included with your Photon OS distribution. To make sure that you have the latest version, you can run:
11
+~~~~
12
+tdnf install netmgmt
13
+~~~~
14
+# Syntax
15
+The CLI is built on set, get, add, delete command model and uses the option-name - option-value model of specifying command parameters.
16
+~~~~
17
+netmgr <network object> <--get | --set | --add | --del> <command options>
18
+~~~~
19
+Passed-in parameter values can be enclosed in single (&#39;) or double-quotes (&quot;) as long as you use matching characters to denote the beginning and end of the value. Unless a parameter value contains special characters or spaces, you can also omit quotes altogether.
20
+
21
+## network object
22
+
23
+``<network object>`` is one of the following values:
24
+
25
+- ``link_info``
26
+- ``ip4_address``
27
+- ``ip6_address``
28
+- ``ip_route``
29
+- ``dns_servers``
30
+- ``dns_domains``
31
+- ``dhcp_duid``
32
+- ``if_iaid``
33
+- ``ntp_servers``
34
+- ``hostname``
35
+- ``wait_for_link``
36
+- ``wait_for_ip``
37
+- ``error_info``
38
+- ``net_info``
39
+
40
+# Network Manager CLI
41
+
42
+## link_info
43
+
44
+Get the mac address, MTU, link state, and link mode for the (optionally) specified interface.
45
+~~~~
46
+netmgr link_info --get --interface <ifname>
47
+~~~~
48
+Set the MAC address, link state (up or down), link mode (manual or auto), or MTU for the specified interface.
49
+~~~~
50
+netmgr link_info --set --interface <ifname> --macaddr <mac_address>
51
+netmgr link_info --set --interface <ifname> --mode <manual|auto>
52
+netmgr link_info --set --interface <ifname> --state <up|down>
53
+netmgr link_info --set --interface <ifname> --mtu <mtu>
54
+~~~~
55
+## ip4_address
56
+
57
+Get the IPv4 address for the specified interface.
58
+~~~~
59
+netmgr ip4_address --get --interface <ifname>
60
+~~~~
61
+Set the IPv4 address (dot-decimal/prefix notation), mode (dhcp, static, or none), and (optionally) the default gateway for the specified interface.
62
+~~~~
63
+netmgr ip4_address --set --interface <ifname> --mode <dhcp|static|none> --addr <ipv4_address/prefix> --gateway <gateway_address>
64
+~~~~
65
+## ip6_address
66
+
67
+Get IPv6 addresses for the specified interface.
68
+~~~~
69
+netmgr ip6_address --get --interface <ifname>
70
+~~~~
71
+Add one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) to the specified interface.
72
+~~~~
73
+netmgr ip6_address --add --interface <ifname> --addrlist <ipv6_addr1/prefix,ipv6_addr2/prefix,...>
74
+~~~~
75
+Delete one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) from the specified interface.
76
+~~~~
77
+netmgr ip6_address --del --interface <ifname> --addrlist <ipv6_addr1/prefix,ipv6_addr2/prefix,...>
78
+~~~~
79
+Set the IPv6 DHCP mode (1=enable, 0=disable) and IPv6 auto-configuration settings (1=enable, 0=disable) for the specified interface.
80
+~~~~
81
+netmgr ip6_address --set --interface <ifname> --dhcp <1|0> --autoconf <1|0>
82
+~~~~
83
+## ip_route
84
+
85
+Get the static IP route for the specified interface.
86
+~~~~
87
+netmgr ip_route --get --interface <ifname>
88
+~~~~
89
+Add the static IP route (gateway IP, destination network, and metric) to the specified interface.
90
+~~~~
91
+netmgr ip_route --add --interface <ifname> --gateway <gateway_address> --destination <destination_network/prefix> --metric <N>
92
+~~~~
93
+Delete the specified static IP route from the specified interface.
94
+~~~~
95
+netmgr ip_route --del --interface <ifname> --destination <destination_network/prefix>
96
+~~~~
97
+## dns_servers
98
+
99
+Get the list of DNS servers.
100
+~~~~
101
+netmgr dns_servers --get
102
+~~~~
103
+Set the DNS mode (DHCP or static) for one or more DNS servers (comma-separated list).
104
+~~~~
105
+netmgr dns_servers --set --mode <dhcp|static> --servers <server1,server2,...>
106
+~~~~
107
+Add a DNS server to the list of DNS servers.
108
+~~~~
109
+netmgr dns_servers --add --servers <server>
110
+~~~~
111
+Remove the specified DNS server from the list of DNS servers.
112
+~~~~
113
+netmgr dns_servers --del --servers <server>
114
+~~~~
115
+## dns_domains
116
+
117
+Get the list of DNS domains.
118
+~~~~
119
+netmgr dns_domains --get
120
+~~~~
121
+Set the list of DNS domains (one or more DNS domains in a comma-separated list).
122
+~~~~
123
+netmgr dns_domains --set --domains <domain1,domain2,...>
124
+~~~~
125
+Add a DNS domain to the list of DNS domains.
126
+~~~~
127
+netmgr dns_domains --add --domains <domain>
128
+~~~~
129
+Delete a DNS domain from the list of DNS domains.
130
+~~~~
131
+netmgr dns_domains --del --domains <domain>
132
+~~~~
133
+## dhcp_duid
134
+
135
+Get the DHCP DUID (optionally interface-specific DUID) for the system.
136
+~~~~
137
+netmgr dhcp_duid --get
138
+~~~~
139
+Set the DHCP DUID for the system, optionally per-interface if the interface is specified.
140
+~~~~
141
+netmgr dhcp_duid --set --duid <duid>
142
+~~~~
143
+## if_iaid
144
+
145
+Get the IAID for the specified interface.
146
+~~~~
147
+netmgr if_iaid --get --interface <ifname>
148
+~~~~
149
+Set the IAID for the specified interface.
150
+~~~~
151
+netmgr if_iaid --set --interface <ifname> --iaid <iaid>
152
+~~~~
153
+## ntp_servers
154
+
155
+Get the NTP servers list.
156
+~~~~
157
+netmgr ntp_servers --get
158
+~~~~
159
+Set the NTP servers list.
160
+~~~~
161
+netmgr ntp_servers --set --servers <server1,server2,...>
162
+~~~~
163
+Add the specified server to the NTP servers list.
164
+~~~~
165
+netmgr ntp_servers --add --servers <server>
166
+~~~~
167
+Delete the specified server from the NTP servers list.
168
+~~~~
169
+netmgr ntp_servers --del --servers <server>
170
+~~~~
171
+## hostname
172
+
173
+Get the system hostname.
174
+~~~~
175
+netmgr hostname --get
176
+~~~~
177
+Set the system hostname.
178
+~~~~
179
+netmgr hostname --set --name <hostname>
180
+~~~~
181
+## wait_for_link
182
+
183
+Wait for the specified network interface to be up and usable (it can send and receive packets).
184
+~~~~
185
+netmgr wait_for_link --interface <ifname> --timeout <timeout>
186
+~~~~
187
+The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
188
+
189
+**Note:** You might need to use wait_for_ip to wait until you can send and receive IP packets.
190
+
191
+## wait_for_ip
192
+
193
+Wait for the specified interface to acquire a valid IP address for the specified address type.
194
+~~~~
195
+netmgr wait_for_ip --interface <ifname> --timeout <timeout> --addrtype <ipv4,ipv6,static_ipv4,static_ipv6,dhcp_ipv4,dhcp_ipv6,auto_ipv6,link_local_ipv6>
196
+~~~~
197
+The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
198
+
199
+## error_info
200
+
201
+Get error information about the specified error code.
202
+~~~~
203
+netmgr error_info --errcode <error_code>
204
+~~~~
205
+Here is a list of error codes:
206
+
207
+- 4097 - invalid parameter
208
+- 4098 - not supported
209
+- 4099 - out of memory
210
+- 4100 - value not found
211
+- 4101 - value exists
212
+- 4102 - invalid interface
213
+- 4103 - invalid mode
214
+- 4104 - bad configuration file
215
+- 4105 - write failed
216
+- 4106 - timeout
217
+- 4107 - DCHP timeout
218
+
219
+## net_info
220
+
221
+Get the specified network configuration parameter for the specified object.
222
+~~~~
223
+netmgr net_info --get --object <ifname or filename> --paramname <param_name>
224
+~~~~
225
+**Note:** The object can be an interface name (for example, &quot;eth0&quot;) or a file name (for example, /etc/systemd/resolved.conf).
226
+
227
+Set the value of the specified network configuration parameter for the specified object (interface or file).
228
+~~~~
229
+netmgr net_info --set --object <ifname or filename> --paramname <param_name> --paramvalue <param_value>
230
+~~~~
231
+**Note** : You can add (+) or remove (-) a parameter by prepending the parameter name with + or -.
232
+
233
+For example, in order to add static IPv4 address "10.10.10.1/24" to eth0 interface, the following command adds this **Address** to the **Network** section of the **eth0** network configuration file.
234
+~~~~
235
+netmgr net_info --set --object eth0 --paramname +Network_Address --paramvalue "10.10.10.1/24"
236
+~~~~
237
+
238
+
0 239
new file mode 100644
... ...
@@ -0,0 +1,1587 @@
0
+# Network Configuration Manager - C API
1
+
2
+Photon OS 2.0 provides a C API for the Network Configuration Manager.
3
+
4
+- [About the Network Configuration Manager C API](#about-the-network-configuration-manager-c-api)
5
+- [Interface Configuration APIs](#interface-configuration-apis)
6
+- [IP Address Configuration APIs](#ip-address-configuration-apis)
7
+- [Route Configuration APIs](#route-configuration-apis)
8
+- [DNS Configuration APIs](#dns-configuration-apis)
9
+- [DHCP Options DUID and IAID Configuration APIs](#dhcp-options-duid-and-iaid-configuration-apis)
10
+- [NTP Configuration APIs](#ntp-configuration-apis)
11
+- [Service Management APIs](#service-management-apis)
12
+
13
+# About the Network Configuration Manager C API
14
+
15
+Use the Network Configuration Manager C API to simplify common network configuration tasks for:
16
+
17
+- interfaces
18
+- IP addresses (IPv4 and IPv6 addresses)
19
+- routes
20
+- DNS server and domain settings
21
+- DHCP DUID and IAID settings
22
+- NTP server settings
23
+- service management
24
+- object parameters (interfaces and files)
25
+
26
+## Header File
27
+
28
+Header files for all the C APIs are defined in the following location:
29
+
30
+[https://github.com/](https://github.com/vmware/pmd/tree/master/include) [vmware](https://github.com/vmware/pmd/tree/master/include) [/pmd/tree/master/include](https://github.com/vmware/pmd/tree/master/include)
31
+
32
+To install the Network Configuration Manager header file, run the following command:
33
+
34
+``tdnf install netmgmt-devel``
35
+n
36
+Once installed, you can reference the header file in the following location:
37
+
38
+``/usr/include/netmgmt/netmgr.h``
39
+
40
+## Freeing Memory
41
+
42
+For all get APIs that take a pointer-to-pointer parameter, the caller has the responsibility to free the memory upon successful response from API by calling free().
43
+
44
+## Error Codes
45
+
46
+All C API calls return 0 for success, or one of the following error codes for failure.
47
+
48
+- 4097 - NM_ERR_INVALID_PARAMETER
49
+- 4098 - NM_ERR_NOT_SUPPORTED
50
+- 4099 - NM_ERR_OUT_OF_MEMORY
51
+- 4100 - NM_ERR_VALUE_NOT_FOUND
52
+- 4101 - NM_ERR_VALUE_EXISTS
53
+- 4102 - NM_ERR_INVALID_INTERFACE
54
+- 4103 - NM_ERR_INVALID_ADDRESS
55
+- 4104 - NM_ERR_INVALID_MODE
56
+- 4105 - NM_ERR_BAD_CONFIG_FILE
57
+- 4106 - NM_ERR_WRITE_FAILED
58
+- 4107 - NM_ERR_TIME_OUT
59
+- 4108 - NM_ERR_DHCP_TIME_OUT
60
+
61
+Use nm_get_error_info to retrieve information about an error code.
62
+~~~~
63
+ const char \*
64
+ nm_get_error_info(
65
+     uint32_t nmErrCode
66
+ );``
67
+~~~~
68
+# Interface Configuration APIs
69
+
70
+The Photon OS 2.0 network manager C API enables you to manage network interfaces.
71
+
72
+## Structure Declarations
73
+
74
+### Link Mode
75
+
76
+**Description**
77
+
78
+Link mode. Available settings:
79
+
80
+- ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
81
+- ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
82
+- ``LINK_MODE_UNKNOWN`` - the link mode is unknown
83
+
84
+**Declaration**
85
+~~~~
86
+ typedef enum _NET_LINK_MODE
87
+ {
88
+     LINK_AUTO = 0,
89
+     LINK_MANUAL,
90
+     LINK_MODE_UNKNOWN
91
+ } NET_LINK_MODE;``
92
+~~~~
93
+### Link State
94
+
95
+**Description**
96
+
97
+Link state. Available settings:
98
+
99
+- ``LINK_DOWN`` - the link is being administratively down or has no carrier signal
100
+- ``LINK_UP`` - the link is configured up and has carrier signal
101
+- ``LINK_STATE_UNKNOWN`` - link state is unknown
102
+
103
+**Declaration**
104
+~~~~
105
+ typedef enum _NET_LINK_STATE
106
+ {
107
+     LINK_DOWN = 0,
108
+     LINK_UP,
109
+     LINK_STATE_UNKNOWN,
110
+ } NET_LINK_STATE;
111
+~~~~
112
+### Link Information
113
+
114
+**Description**
115
+
116
+Link information. Includes the following information:
117
+
118
+- ``pszInterfaceName`` - interface name
119
+- ``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
120
+- ``mtu`` - maximum transmission unit (MTU)
121
+- ``mode`` - link mode (see above)
122
+- ``state`` - link state (see above)
123
+
124
+**Declaration**
125
+~~~~
126
+ typedef struct _NET_LINK_INFO
127
+ {
128
+     struct _NET_LINK_INFO \*pNext;
129
+     char \*pszInterfaceName;
130
+     char \*pszMacAddress;
131
+     uint32_t mtu;
132
+     NET_LINK_MODE mode;
133
+     NET_LINK_STATE state;
134
+ } NET_LINK_INFO, \*PNET_LINK_INFO;
135
+~~~~
136
+## nm_set_link_mac_addr
137
+
138
+**Description**
139
+
140
+Set the MAC address of the interface.
141
+
142
+**Declaration**
143
+~~~~
144
+uint32_t
145
+
146
+nm_set_link_mac_addr(
147
+
148
+     const char \*pszInterfaceName,
149
+     const char \*pszMacAddress
150
+ );
151
+~~~~
152
+**Arguments**
153
+
154
+- ``pszInterfaceName`` - interface name
155
+- ``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
156
+
157
+**Returns**
158
+
159
+- success: 0
160
+- failure: error code
161
+
162
+## nm_get_link_mac_addr
163
+
164
+**Description**
165
+
166
+Get the MAC address of the interface.
167
+
168
+**Declaration**
169
+~~~~
170
+uint32_t
171
+ nm_get_link_mac_addr(
172
+     const char \*pszInterfaceName,
173
+     char \*\*ppszMacAddress
174
+ );
175
+~~~~
176
+**Arguments**
177
+
178
+- ``pszInterfaceName`` - interface name
179
+- ``ppszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
180
+
181
+**Returns**
182
+
183
+- success: 0
184
+- failure: error code
185
+
186
+## nm_set_link_mode
187
+
188
+**Description**
189
+
190
+Set the mode of the interface (auto or manual).
191
+
192
+**Declaration**
193
+~~~~
194
+uint32_t
195
+ nm_set_link_mode(
196
+     const char \*pszInterfaceName,
197
+     NET_LINK_MODE mode
198
+ );
199
+~~~~
200
+**Arguments**
201
+
202
+- ``pszInterfaceName`` - interface name
203
+- ``mode`` - link mode. One of the following values:
204
+  - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
205
+  - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
206
+  - ``LINK_MODE_UNKNOWN`` - the link mode is unknown
207
+
208
+**Returns**
209
+
210
+- success: 0
211
+- failure: error code
212
+
213
+## nm_get_link_mode
214
+
215
+**Description**
216
+
217
+Get the mode of the interface (auto or manual).
218
+
219
+**Declaration**
220
+~~~~
221
+uint32_t
222
+ nm_get_link_mode(
223
+     const char \*pszInterfaceName,
224
+     NET_LINK_MODE \*pLinkMode
225
+ );
226
+~~~~
227
+**Arguments**
228
+
229
+- ``pszInterfaceName`` - interface name
230
+- ``pLinkMode`` - link mode. One of the following values:
231
+  - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
232
+  - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
233
+  - ``LINK_MODE_UNKNOWN`` - the link mode is unknown
234
+
235
+**Returns**
236
+
237
+- success: 0
238
+- failure: error code
239
+
240
+## nm_set_link_mtu
241
+
242
+**Description**
243
+
244
+Set the maximum transmission unit (MTU) of the interface.
245
+
246
+**Declaration**
247
+~~~~
248
+uint32_t
249
+ nm_set_link_mtu(
250
+     const char \*pszInterfaceName,
251
+     uint32_t mtu
252
+ );
253
+~~~~
254
+**Arguments**
255
+
256
+- ``pszInterfaceName`` - interface name
257
+- ``mtu`` - maximum transmission unit (MTU)
258
+
259
+**Returns**
260
+
261
+- success: 0
262
+- failure: error code
263
+
264
+## nm_get_link_mtu
265
+
266
+**Description**
267
+
268
+Get the maximum transmission unit (MTU) of the interface.
269
+
270
+**Declaration**
271
+~~~~
272
+nm_get_link_mtu
273
+ uint32_t
274
+ nm_get_link_mtu(
275
+     const char \*pszInterfaceName,
276
+     uint32_t \*pMtu
277
+ );
278
+~~~~
279
+**Arguments**
280
+
281
+- ``pszInterfaceName`` - interface name
282
+- ``pMtu`` - maximum transmission unit (MTU)
283
+
284
+**Returns**
285
+
286
+- success: 0
287
+- failure: error code
288
+
289
+## nm_set_link_state
290
+
291
+**Description**
292
+
293
+Set the link state of the interface (up or down).
294
+
295
+**Declaration**
296
+~~~~
297
+ uint32_t
298
+ nm_set_link_state(
299
+     const char \*pszInterfaceName,
300
+     NET_LINK_STATE state
301
+ );
302
+~~~~
303
+**Arguments**
304
+
305
+- ``pszInterfaceName`` - interface name
306
+- ``state`` - link state. One of the following values:
307
+  - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal.
308
+  - ``LINK_UP`` - the link is configured up and has carrier signal.
309
+  - ``LINK_STATE_UNKNOWN`` - the link state is unknown
310
+
311
+**Returns**
312
+
313
+- success: 0
314
+- failure: error code
315
+
316
+## nm_get_link_state
317
+
318
+**Description**
319
+
320
+Get the link state of the interface (up or down).
321
+
322
+**Declaration**
323
+~~~~
324
+uint32_t
325
+ nm_get_link_state(
326
+     const char \*pszInterfaceName,
327
+     NET_LINK_STATE \*pLinkState
328
+ );
329
+~~~~
330
+**Arguments**
331
+
332
+- ``pszInterfaceName`` - interface name
333
+- ``pLinkState`` - link state. One of the following values:
334
+  - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal
335
+  - ``LINK_UP`` - the link is configured up and has carrier signal
336
+  - ``LINK_STATE_UNKNOWN`` - the link state is unknown
337
+
338
+**Returns**
339
+
340
+- success: 0
341
+- failure: error code
342
+
343
+## nm_ifup
344
+
345
+**Description**
346
+
347
+Set the specified interface state to UP. Additionally, if the interface is configured to have an IP address, it waits for the interface to acquire the IP address, and then updates neighbors of its IP address via the address resolution protocol (ARP) messages.
348
+
349
+**Declaration**
350
+~~~~
351
+ uint32_t
352
+ nm_ifup(
353
+     const char \*pszInterfaceName
354
+ );
355
+~~~~
356
+**Arguments**
357
+
358
+- ``pszInterfaceName`` - interface name
359
+
360
+**Returns**
361
+
362
+- success: 0
363
+- failure: error code
364
+
365
+## nm_ifdown
366
+
367
+**Description**
368
+
369
+Set the specified interface state to DOWN.
370
+
371
+**Declaration**
372
+~~~~
373
+uint32_t
374
+ nm_ifdown(
375
+     const char \*pszInterfaceName
376
+ );
377
+~~~~
378
+**Arguments**
379
+
380
+- ``pszInterfaceName`` - interface name
381
+
382
+**Returns**
383
+
384
+- success: 0
385
+- failure: error code
386
+
387
+## nm_get_link_info
388
+
389
+**Description**
390
+
391
+Get link information for the interface. The caller is responsible for freeing ppLinkInfo by calling nm_free_link_info.
392
+
393
+**Declaration**
394
+~~~~
395
+uint32_t
396
+ nm_get_link_info(
397
+     const char \*pszInterfaceName,
398
+     NET_LINK_INFO \*\*ppLinkInfo
399
+ );
400
+~~~~
401
+**Arguments**
402
+
403
+- ``pszInterfaceName`` - interface name
404
+- ``ppLinkInfo``, which includes the following information:
405
+  - \*``pszInterfaceName`` - interface name
406
+  - \*``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
407
+  - ``mtu`` - maximum transmission unit (MTU)
408
+  - ``mode`` - One of the following values:
409
+    - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
410
+    - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
411
+    - ``LINK_MODE_UNKNOWN`` - the link mode is unknown
412
+  - ``state`` - One of the following values:
413
+    - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal
414
+    - ``LINK_UP`` - the link is configured up and has carrier signal
415
+    - ``LINK_STATE_UNKNOWN`` - the link state is unknown
416
+
417
+**Returns**
418
+
419
+- success: 0
420
+- failure: error code
421
+
422
+## nm_free_link_info
423
+
424
+**Description**
425
+
426
+Frees the NET_LINK_INFO structure returned by a successful nm_get_link_info call.
427
+
428
+**Declaration**
429
+~~~~
430
+void
431
+ nm_free_link_info(
432
+     NET_LINK_INFO \*pNetLinkInfo
433
+ );
434
+~~~~
435
+**Arguments**
436
+
437
+- ``pNetLinkInfo``, which includes the following information:
438
+  - \*``pszInterfaceName`` - interface name
439
+  - \*``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b")
440
+  - ``mtu`` - maximum transmission unit (MTU)
441
+  - ``mode`` - One of the following values:
442
+    - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager
443
+    - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface
444
+    - ``LINK_MODE_UNKNOWN`` - the link mode is unknown
445
+  - ``state`` - One of the following values:
446
+    - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal
447
+    - ``LINK_UP`` - the link is configured up and has carrier signal
448
+    - ``LINK_STATE_UNKNOWN`` - the link state is unknown
449
+
450
+**Returns**
451
+
452
+- success: 0
453
+- failure: error code
454
+
455
+# IP Address Configuration APIs
456
+
457
+The Photon OS 2.0 network manager C API enables you to manage IP addresses for interfaces that are managed by systemd network manager.
458
+
459
+## Structure Declarations
460
+
461
+### IP Address Mode
462
+
463
+**Description**
464
+
465
+Defines the IP address mode. One of the following values:
466
+
467
+- ``IPV4_ADDR_MODE_NONE`` - no IPv4 address configured on the interface
468
+- ``IPV4_ADDR_MODE_STATIC`` - the interface is configured with a static IPv4 address
469
+- ``IPV4_ADDR_MODE_DHCP`` -  the interface is configured with a DHCP IPv4 address
470
+
471
+**Declaration**
472
+~~~~
473
+ typedef enum _NET_IPV4_ADDR_MODE
474
+ {
475
+     IPV4_ADDR_MODE_NONE = 0,
476
+     IPV4_ADDR_MODE_STATIC,
477
+     IPV4_ADDR_MODE_DHCP,
478
+     IPV4_ADDR_MODE_MAX
479
+ } NET_IPV4_ADDR_MODE;
480
+~~~~
481
+### Address Type
482
+
483
+**Description**
484
+
485
+Defines the type of IP address. One of the following options:
486
+
487
+- ``STATIC_IPV4`` - static IPv4 address
488
+- ``STATIC_IPV6`` - static IPv6 address
489
+- ``DHCP_IPV4`` - DHCP IPv4 address
490
+- ``DHCP_IPV6`` - DHCP IPv6 address
491
+- ``AUTO_IPV6`` - stateless dynamic IPv6 address
492
+- ``LINK_LOCAL_IPV6`` - link local IPv6 address
493
+
494
+**Declaration**
495
+~~~~
496
+ typedef enum _NET_ADDR_TYPE
497
+ {
498
+     STATIC_IPV4        =  0x00000001,
499
+     STATIC_IPV6        =  0x00000002,
500
+     DHCP_IPV4          =  0x00000010,
501
+     DHCP_IPV6          =  0x00000020,
502
+     AUTO_IPV6          =  0x00000040,
503
+     LINK_LOCAL_IPV6    =  0x00000080,
504
+ } NET_ADDR_TYPE;
505
+~~~~
506
+### IP Addresses
507
+
508
+**Description**
509
+
510
+Defines IP addresses.
511
+
512
+- ``pszInterfaceName`` - interface name
513
+- ``type`` - address type
514
+- ``pszIPAddrPrefix`` - IP address
515
+
516
+**Declarations**
517
+~~~~
518
+ typedef struct _NET_IP_ADDR
519
+ {
520
+     char \*pszInterfaceName;
521
+     NET_ADDR_TYPE type;
522
+     char \*pszIPAddrPrefix;
523
+ } NET_IP_ADDR, \*PNET_IP_ADDR;
524
+~~~~
525
+## nm_set_ipv4_addr_gateway
526
+
527
+**Description**
528
+
529
+Set the IPv4 address and (optionally) the default gateway address for the interface.
530
+
531
+**Declaration**
532
+~~~~
533
+ uint32_t
534
+
535
+ nm_set_ipv4_addr_gateway(
536
+
537
+     const char \*pszInterfaceName,
538
+     NET_IPV4_ADDR_MODE mode,
539
+     const char \*pszIPv4AddrPrefix,
540
+     const char \*pszIPv4Gateway
541
+ );
542
+~~~~
543
+**Arguments**
544
+
545
+- ``pszInterfaceName`` - interface name
546
+- ``mode`` - IP address mode; one of the following values:
547
+  - ``IPV4_ADDR_MODE_NONE``
548
+  - ``IPV4_ADDR_MODE_STATIC``
549
+  - ``IPV4_ADDR_MODE_DHCP``
550
+- ``pszIPv4AddrPrefix`` - IPv4 address specified in dot-decimal / prefix notation (for example, 10.10.10.101/23). If the prefix is not specified, then a /32 prefix is assumed.
551
+- ``pszIPv4Gateway`` - IPv4 gateway (optional) specified in the dot-decimal format (for example,10.10.20.30).
552
+
553
+**Returns**
554
+
555
+- success: 0
556
+- failure: error code
557
+
558
+## nm_get_ipv4_addr_gateway
559
+
560
+**Description**
561
+
562
+Get the IPv4 address and the default gateway address for the interface.
563
+
564
+**Declaration**
565
+~~~~
566
+uint32_t
567
+ nm_get_ipv4_addr_gateway(
568
+     const char \*pszInterfaceName,
569
+     NET_IPV4_ADDR_MODE \*pMode,
570
+     char \*\*ppszIPv4AddrPrefix,
571
+     char \*\*ppszIPv4Gateway
572
+ );
573
+~~~~
574
+**Arguments**
575
+
576
+- ``pszInterfaceName`` - interface name
577
+- ``pmode`` - IP mode; one of the following values:
578
+  - ``IPV4_ADDR_MODE_NONE``
579
+  - ``IPV4_ADDR_MODE_STATIC``
580
+  - ``IPV4_ADDR_MODE_DHCP``
581
+- ``ppszIPv4AddrPrefix`` - IPv4 address returned in dot-decimal / prefix notation (for example, 10.10.10.101/23). If the prefix is not specified, then a /32 prefix is assumed.
582
+- ``ppszIPv4Gateway`` - IPv4 gateway (optional) returned in the dot-decimal format (for example,10.10.10.250).
583
+
584
+**Returns**
585
+
586
+- success: 0
587
+- failure: error code
588
+
589
+## nm_add_static_ipv6_addr
590
+
591
+**Description**
592
+
593
+Add an IPv6 address to the specified interface.
594
+
595
+**Declaration**
596
+~~~~
597
+uint32_t
598
+ nm_add_static_ipv6_addr(
599
+     const char \*pszInterfaceName,
600
+     const char \*pszIPv6AddrPrefix
601
+ );
602
+~~~~
603
+**Arguments**
604
+
605
+- ``pszInterfaceName`` - interface name
606
+- ``pszIPv6AddrPrefix`` - IPv6 address specified in the standard colon-separated IPv6 address format followed by the prefix (for example, 2010:a1:b2::25/64). If the not prefix is specified, then a /128 prefix is assumed.
607
+
608
+**Returns**
609
+
610
+- success: 0
611
+- failure: error code
612
+
613
+## nm_delete_static_ipv6_addr
614
+
615
+**Description**
616
+
617
+Delete a static IPv6 address from the interface.
618
+
619
+**Declaration**
620
+~~~~
621
+uint32_t
622
+ nm_delete_static_ipv6_addr(
623
+     const char \*pszInterfaceName,
624
+     const char \*pszIPv6AddrPrefix
625
+ );
626
+~~~~
627
+**Arguments**
628
+
629
+- ``pszInterfaceName`` - interface name
630
+- ``pszIPv6AddrPrefix`` - IPv6 address specified in the standard colon-separated IPv6 address format followed by the prefix (for example, 2010:a1:b2::25/64). If the not prefix is specified, then a /128 prefix is assumed.
631
+
632
+**Returns**
633
+
634
+- success: 0
635
+- failure: error code
636
+
637
+## nm_set_ipv6_addr_mode
638
+
639
+**Description**
640
+
641
+Set the mode for the interface.
642
+
643
+**Declaration**
644
+~~~~
645
+uint32_t
646
+ nm_set_ipv6_addr_mode(
647
+     const char \*pszInterfaceName,
648
+     uint32_t enableDhcp,
649
+     uint32_t enableAutoconf
650
+ );
651
+~~~~
652
+**Arguments**
653
+
654
+- ``pszInterfaceName`` - interface name
655
+- ``enableDhcp`` - enable (1) or disable (0) DHCP; enabling configures the interface to acquire a DHCP IPv6 address.
656
+- ``enableAutoconf`` - enable (1) or disable (0) autoconf; enabling configures the interface to acquire a stateless autoconfiguration IPv6 address.
657
+
658
+**Returns**
659
+
660
+- success: 0
661
+- failure: error code
662
+
663
+## nm_get_ipv6_addr_mode
664
+
665
+**Description**
666
+
667
+Get the mode for the interface.
668
+
669
+**Declaration**
670
+~~~~
671
+ uint32_t
672
+ nm_get_ipv6_addr_mode(
673
+     const char \*pszInterfaceName,
674
+     uint32_t \*pDhcpEnabled,
675
+     uint32_t \*pAutoconfEnabled
676
+ );
677
+~~~~
678
+**Arguments**
679
+
680
+- ``pszInterfaceName`` - interface name
681
+- ``pDhcpEnabled`` - returns whether IPv6 DHCP is enabled (1) or disabled (0).
682
+- ``pAutoconfEnabled`` - returns whether IPv6 stateless autoconfiguration is enabled (1) or disabled (0).
683
+
684
+**Returns**
685
+
686
+- success: 0
687
+- failure: error code
688
+
689
+## nm_get_ip_addr
690
+
691
+**Description**
692
+
693
+Get the IP address for the interface.
694
+
695
+**Declaration**
696
+~~~~
697
+uint32_t
698
+ nm_get_ip_addr(
699
+     const char \*pszInterfaceName,
700
+     uint32_t addrTypes,
701
+     size_t \*pCount,
702
+     NET_IP_ADDR \*\*\*pppIpAddrList
703
+ );
704
+~~~~
705
+**Arguments**
706
+
707
+- ``pszInterfaceName`` - interface name
708
+- ``addrTypes`` - type of IP address; one of the following values:
709
+  - ``STATIC_IPV4``
710
+  - ``STATIC_IPV6``
711
+  - ``DHCP_IPV4``
712
+  - ``DHCP_IPV6``
713
+  - ``AUTO_IPV6``
714
+  - ``LINK_LOCAL_IPV6``
715
+- ``pCount`` - number of IP address structures in the pppIpAddrList array returned by the API call.
716
+- ``pppIpAddrList`` - array of NET_IP_ADDR elements that includes the following:
717
+  - ``pszInterfaceName``
718
+  - ``type``
719
+  - ``pszIPAddrPrefix``
720
+
721
+**Returns**
722
+
723
+- success: 0
724
+- failure: error code
725
+
726
+## nm_set_ipv6_gateway
727
+
728
+**Description**
729
+
730
+Set the default IPv6 gateway for the interface.
731
+
732
+**Declaration**
733
+~~~~
734
+ uint32_t
735
+ nm_set_ipv6_gateway(
736
+     const char \*pszInterfaceName,
737
+     const char \*pszIPv6Gateway
738
+ );
739
+~~~~
740
+**Arguments**
741
+
742
+- ``pszInterfaceName`` - interface name
743
+- ``pszIPv6Gateway`` - IPv6 gateway specified in the standard colon-separated IPv6 address format (for example, 2010:125::100)
744
+
745
+**Returns**
746
+
747
+- success: 0
748
+- failure: error code
749
+
750
+## nm_get_ipv6_gateway
751
+
752
+**Description**
753
+
754
+Get the default IPv6 gateway for the interface.
755
+
756
+**Declaration**
757
+~~~~
758
+ uint32_t
759
+ nm_get_ipv6_gateway(
760
+     const char \*pszInterfaceName,
761
+     char \*\*ppszIPv6Gateway
762
+ );
763
+~~~~
764
+**Arguments**
765
+
766
+- ``pszInterfaceName`` - interface name
767
+- ``ppszIPv6Gateway`` - IPv6 gateway specified in the standard colon-separated IPv6 address format (for example, 2010:125::100)
768
+
769
+**Returns**
770
+
771
+- success: 0
772
+- failure: error code
773
+
774
+# Route Configuration APIs
775
+
776
+The Photon OS 2.0 network manager C API enables you to manage static IP routes configuration.
777
+
778
+## Structure Declarations
779
+
780
+### Route Scope
781
+
782
+**Description**
783
+
784
+Defines the scope of a route. One of the following options.
785
+
786
+- ``GLOBAL_ROUTE`` - route to a destination one or more hops away
787
+- ``LINK_ROUTE`` - route to a destination on the local network
788
+- ``HOST_ROUTE`` - route to a destination address on the local host
789
+
790
+**Declaration**
791
+~~~~
792
+ typedef enum _NET_ROUTE_SCOPE
793
+ {
794
+     GLOBAL_ROUTE = 0,
795
+     LINK_ROUTE,
796
+     HOST_ROUTE,
797
+     NET_ROUTE_SCOPE_MAX
798
+ } NET_ROUTE_SCOPE;
799
+~~~~
800
+### IP Route
801
+
802
+**Description**
803
+
804
+Defines an IP route. Includes the following information:
805
+
806
+- ``pszInterfaceName`` - interface through which the specified destination network can be reached
807
+- ``pszDestNetwork`` - destination IP network reached by the specified route
808
+- ``pszSourceNetwork`` - source network for the specified route
809
+- ``pszGateway`` - IP gateway through which the specified destination network can be reached
810
+- ``scope`` - scope of this route entry; one of the following values: GLOBAL_ROUTE, LINK_ROUTE, or HOST_ROUTE as defined above
811
+- ``metric`` - metric of this route, an unsigned integer
812
+- ``table`` - identifier for the route table to which this route belongs.
813
+
814
+**Declaration**
815
+~~~~
816
+ typedef struct _NET_IP_ROUTE
817
+ {
818
+     char \*pszInterfaceName;
819
+     char \*pszDestNetwork;
820
+     char \*pszSourceNetwork;
821
+     char \*pszGateway;
822
+     NET_ROUTE_SCOPE scope;
823
+     uint32_t metric;
824
+     uint32_t table;
825
+ } NET_IP_ROUTE, \*PNET_IP_ROUTE;
826
+~~~~
827
+## nm_add_static_ip_route
828
+
829
+**Description**
830
+
831
+Add a static IP route.
832
+
833
+**Declaration**
834
+~~~~
835
+uint32_t
836
+ nm_add_static_ip_route(
837
+     NET_IP_ROUTE \*pRoute
838
+ );
839
+~~~~
840
+**Arguments**
841
+
842
+- ``pRoute`` - static IP route
843
+
844
+**Returns**
845
+
846
+- success: 0
847
+- failure: error code
848
+
849
+## nm_delete_static_ip_route
850
+
851
+**Description**
852
+
853
+Delete a static IP route.
854
+
855
+**Declaration**
856
+~~~~
857
+ uint32_t
858
+ nm_delete_static_ip_route(
859
+     NET_IP_ROUTE \*pRoute
860
+ );
861
+~~~~
862
+**Arguments**
863
+
864
+- ``pRoute`` - static IP route
865
+
866
+**Returns**
867
+
868
+- success: 0
869
+- failure: error code
870
+
871
+## nm_get_static_ip_routes
872
+
873
+**Description**
874
+
875
+Get the static IP routes for an interface.
876
+
877
+**Declaration**
878
+~~~~
879
+ uint32_t
880
+ nm_get_static_ip_routes(
881
+     const char \*pszInterfaceName,
882
+     size_t \*pCount,
883
+     NET_IP_ROUTE \*\*\*pppRouteList
884
+ );
885
+~~~~
886
+**Arguments**
887
+
888
+- ``pszInterfaceName`` - interface name
889
+- ``pCount`` - number of NET_IP_ROUTE elements returned in the pppRouteList array by the API call upon success
890
+- ``pppRouteList`` - array of static IP routes
891
+
892
+**Returns**
893
+
894
+- success: 0
895
+- failure: error code
896
+
897
+# DNS Configuration APIs
898
+
899
+The Photon OS 2.0 network manager C API enables you to manage the DNS and Domains configuration.
900
+
901
+## Structure Declarations
902
+
903
+### DNS Mode
904
+
905
+**Description**
906
+
907
+DNS mode. Any of the following values:
908
+
909
+- ``DNS_MODE_INVALID`` - DNS mode is unknown
910
+- ``STATIC_DNS`` - DNS servers are statically configured
911
+- ``DHCP_DNS`` - DNS servers configuration is acquired from DHCP protocol.
912
+
913
+**Declaration**
914
+~~~~
915
+ typedef enum _NET_DNS_MODE
916
+ {
917
+     DNS_MODE_INVALID = 0,
918
+     STATIC_DNS,
919
+     DHCP_DNS,
920
+     DNS_MODE_MAX,
921
+ } NET_DNS_MODE;
922
+~~~~
923
+## nm_set_dns_servers
924
+
925
+**Description**
926
+
927
+Set the DNS servers list for the interface.
928
+
929
+**Declaration**
930
+~~~~
931
+uint32_t
932
+ nm_set_dns_servers(
933
+     const char \*pszInterfaceName,
934
+     NET_DNS_MODE mode,
935
+     size_t count,
936
+     const char \*\*ppszDnsServers
937
+ );
938
+~~~~
939
+**Arguments**
940
+
941
+- ``pszInterfaceName`` - interface name (optional, can be NULL)
942
+- ``mode`` - DNS mode. One of the following values:
943
+  - ``DNS_MODE_INVALID`` = 0
944
+  - ``DNS_MODE_MA``
945
+  - ``DHCP_DNS``
946
+  - ``STATIC_DNS``
947
+- ``count`` - number of NUL terminated DNS server entries passed in the ppszDnsServers array to the API call (for example, 10.10.10.200 or 2020::40)
948
+- ``ppszDnsServers`` - array of DNS servers
949
+
950
+**Returns**
951
+
952
+- success: 0
953
+- failure: error code
954
+
955
+## nm_add_dns_server
956
+
957
+**Description**
958
+
959
+Add a server to the DNS servers list associated with an interface.
960
+
961
+**Declaration**
962
+~~~~
963
+uint32_t
964
+ nm_add_dns_server(
965
+     const char \*pszInterfaceName,
966
+     const char \*pszDnsServer
967
+ );
968
+~~~~
969
+**Arguments**
970
+
971
+- ``pszInterfaceName`` - interface name (optional, can be NULL)
972
+- ``ppszDnsServer`` - server to add to the DNS server list
973
+
974
+**Returns**
975
+
976
+- success: 0
977
+- failure: error code
978
+
979
+## nm_delete_dns_server
980
+
981
+**Description**
982
+
983
+Delete a server from the DNS servers list associated with an interface.
984
+
985
+**Declaration**
986
+~~~~
987
+ uint32_t
988
+ nm_delete_dns_server(
989
+     const char \*pszInterfaceName,
990
+     const char \*pszDnsServer
991
+ );
992
+~~~~
993
+**Arguments**
994
+
995
+- ``pszInterfaceName`` - interface name (optional, can be NULL)
996
+- ``ppszDnsServer`` - server to remove from the DNS server list
997
+
998
+**Returns**
999
+
1000
+- success: 0
1001
+- failure: error code
1002
+
1003
+## nm_get_dns_servers
1004
+
1005
+**Description**
1006
+
1007
+Get the the DNS servers list for the interface.
1008
+
1009
+**Declaration**
1010
+~~~~
1011
+uint32_t
1012
+ nm_get_dns_servers(
1013
+     const char \*pszInterfaceName,
1014
+     NET_DNS_MODE \*pMode,
1015
+     size_t \*pCount,
1016
+     char \*\*\*pppszDnsServers
1017
+ );
1018
+~~~~
1019
+**Arguments**
1020
+
1021
+- ``pszInterfaceName`` - interface name (optional, can be NULL)
1022
+- ``pMode`` - DNS mode. One of the following values:
1023
+  - ``DNS_MODE_INVALID``
1024
+  - ``DHCP_DNS``
1025
+  - ``STATIC_DNS``
1026
+- ``pCount`` - number of NUL terminated DNS server entries in the pppszDnsServers array returned by the API call (for example, 10.10.10.200 or 2020::40)
1027
+- ``pppszDnsServers`` - array of DNS servers
1028
+
1029
+**Returns**
1030
+
1031
+- success: 0
1032
+- failure: error code
1033
+
1034
+## nm_set_dns_domains
1035
+
1036
+**Description**
1037
+
1038
+Set the DNS domain list.
1039
+
1040
+**Declaration**
1041
+~~~~
1042
+uint32_t
1043
+ nm_set_dns_domains(
1044
+     const char \*pszInterfaceName,
1045
+     size_t count,
1046
+     const char \*\*ppszDnsDomains
1047
+ );
1048
+~~~~
1049
+**Arguments**
1050
+
1051
+- ``pszInterfaceName`` - interface name (optional, can be NULL)
1052
+- ``count`` - number of DNS domains specified in the ppszDnsDomains array to the API call (for example, if count = 2, then there are two elements: ppszDnsDomains[0] and ppszDnsDomains[1])
1053
+- ``ppszDnsDomains`` - array of DNS domains
1054
+
1055
+**Returns**
1056
+
1057
+- success: 0
1058
+- failure: error code
1059
+
1060
+## nm_add_dns_domain
1061
+
1062
+**Description**
1063
+
1064
+Add a DNS domain to the DNS domain list.
1065
+
1066
+**Declaration**
1067
+~~~~
1068
+uint32_t
1069
+ nm_add_dns_domain(
1070
+     const char \*pszInterfaceName,
1071
+     const char \*pszDnsDomain
1072
+ );
1073
+~~~~
1074
+**Arguments**
1075
+
1076
+- ``pszInterfaceName`` - interface name (optional, can be NULL)
1077
+- ``pszDnsDomain`` - DNS domain to add to the list
1078
+
1079
+**Returns**
1080
+
1081
+- success: 0
1082
+- failure: error code
1083
+
1084
+## nm_delete_dns_domain
1085
+
1086
+**Description**
1087
+
1088
+Delete a DNS domain from the DNS domain list.
1089
+
1090
+**Declaration**
1091
+~~~~
1092
+uint32_t
1093
+ nm_delete_dns_domain(
1094
+     const char \*pszInterfaceName,
1095
+     const char \*pszDnsDomain
1096
+ );
1097
+~~~~
1098
+**Arguments**
1099
+
1100
+- ``pszInterfaceName`` - interface name (optional, can be NULL)
1101
+- ``pszDnsDomain`` - DNS domain to remove from the list
1102
+
1103
+**Returns**
1104
+
1105
+- success: 0
1106
+- failure: error code
1107
+
1108
+## nm_get_dns_domains
1109
+
1110
+**Description**
1111
+
1112
+Get the list of DNS domains.
1113
+
1114
+**Declaration**
1115
+~~~~
1116
+uint32_t
1117
+ nm_get_dns_domains(
1118
+     const char \*pszInterfaceName,
1119
+     size_t \*pCount,
1120
+     char \*\*\*pppszDnsDomains
1121
+ );
1122
+~~~~
1123
+**Arguments**
1124
+
1125
+- ``pszInterfaceName`` - interface name (optional, can be NULL)
1126
+- ``pCount`` - number of DNS domains returned in the pppszDnsDomains from the API call (for example, if count = 2, then there are two elements: ppszDnsDomains[0] and ppszDnsDomains[1])
1127
+- ``pppszDnsDomains`` - array of DNS domains
1128
+
1129
+**Returns**
1130
+
1131
+- success: 0
1132
+- failure: error code
1133
+
1134
+# DHCP Options DUID and IAID Configuration APIs
1135
+
1136
+The Photon OS 2.0 network manager C API enables you to manage DHCP DUID and Interface IAID.
1137
+
1138
+## nm_set_iaid
1139
+
1140
+**Description**
1141
+
1142
+Set the IAID for the interface.
1143
+
1144
+**Declaration**
1145
+~~~~
1146
+uint32_t
1147
+ nm_set_iaid(
1148
+     const char \*pszInterfaceName,
1149
+     uint32_t iaid
1150
+ );
1151
+~~~~
1152
+**Arguments**
1153
+
1154
+- ``pszInterfaceName`` - interface name
1155
+- ``iaid`` - interface association identifier (IAID)
1156
+
1157
+**Returns**
1158
+
1159
+- success: 0
1160
+- failure: error code
1161
+
1162
+## nm_get_iaid
1163
+
1164
+**Description**
1165
+
1166
+Get the IAID for the interface.
1167
+
1168
+**Declaration**
1169
+~~~~
1170
+uint32_t
1171
+ nm_get_iaid(
1172
+     const char \*pszInterfaceName,
1173
+     uint32_t \*pIaid
1174
+ );
1175
+~~~~
1176
+**Arguments**
1177
+
1178
+- ``pszInterfaceName`` - interface name
1179
+- ``pIaid`` - interface association identifier (IAID)
1180
+
1181
+**Returns**
1182
+
1183
+- success: 0
1184
+- failure: error code
1185
+
1186
+## nm_set_duid
1187
+
1188
+**Description**
1189
+
1190
+Set the DUID for the interface.
1191
+
1192
+**Declaration**
1193
+~~~~
1194
+uint32_t
1195
+ nm_set_duid(
1196
+     const char \*pszInterfaceName,
1197
+     const char \*pszDuid
1198
+ );
1199
+~~~~
1200
+**Arguments**
1201
+
1202
+- ``pszInterfaceName`` - interface name (optional, specify NULL to set system global DUID configuration)
1203
+- ``pszDuid`` - DHCP unique identifier (DUID)
1204
+
1205
+**Returns**
1206
+
1207
+- success: 0
1208
+- failure: error code
1209
+
1210
+## nm_get_duid
1211
+
1212
+**Description**
1213
+
1214
+Get the DUID for the interface.
1215
+
1216
+**Declaration**
1217
+~~~~
1218
+uint32_t
1219
+ nm_get_duid(
1220
+     const char \*pszInterfaceName,
1221
+     char \*\*ppszDuid
1222
+ );
1223
+~~~~
1224
+**Arguments**
1225
+
1226
+- ``pszInterfaceName`` - interface name (optional, specify NULL to query system global DUID configuration)
1227
+- ``ppszDuid`` - DHCP unique identifier (DUID)
1228
+
1229
+**Returns**
1230
+
1231
+- success: 0
1232
+- failure: error code
1233
+
1234
+# NTP Configuration APIs
1235
+
1236
+The Photon OS 2.0 network manager C API enables you to manage NTP servers configured for the system.
1237
+
1238
+## nm_set_ntp_servers
1239
+
1240
+**Description**
1241
+
1242
+Set the list of NTP servers.
1243
+
1244
+**Declaration**
1245
+~~~~
1246
+ uint32_t
1247
+ nm_set_ntp_servers(
1248
+     size_t count,
1249
+     const char \*\*ppszNtpServers
1250
+ );
1251
+~~~~
1252
+**Arguments**
1253
+
1254
+- ``count`` - number of NTP servers in the ppszNtpServers array passed to the API call.
1255
+- ``ppszNtpServers`` - array of NTP servers
1256
+
1257
+**Returns**
1258
+
1259
+- success: 0
1260
+- failure: error code
1261
+
1262
+## nm_add_ntp_servers
1263
+
1264
+**Description**
1265
+
1266
+Add a server to the NTP servers list.
1267
+
1268
+**Declaration**
1269
+~~~~
1270
+ uint32_t
1271
+ nm_add_ntp_servers(
1272
+     size_t count,
1273
+     const char \*\*ppszNtpServers
1274
+ );
1275
+~~~~
1276
+**Arguments**
1277
+
1278
+- ``count`` - number of NTP servers to add (specified in the ppszNtpServers array) passed to the API call.
1279
+- ``ppszNtpServers`` - array of NTP servers to add
1280
+
1281
+**Returns**
1282
+
1283
+- success: 0
1284
+- failure: error code
1285
+
1286
+## nm_delete_ntp_servers
1287
+
1288
+**Description**
1289
+
1290
+Delete a server from the NTP servers list.
1291
+
1292
+**Declaration**
1293
+~~~~
1294
+ uint32_t
1295
+ nm_delete_ntp_servers(
1296
+     size_t count,
1297
+     const char \*\*ppszNtpServers
1298
+ );
1299
+~~~~
1300
+**Arguments**
1301
+
1302
+- ``count`` - number of NTP servers to delete (specified in the ppszNtpServers array) passed to the API call
1303
+- ``ppszNtpServers`` - array of NTP servers to delete
1304
+
1305
+**Returns**
1306
+
1307
+- success: 0
1308
+- failure: error code
1309
+
1310
+## nm_get_ntp_servers
1311
+
1312
+**Description**
1313
+
1314
+Get the NTP servers list.
1315
+
1316
+**Declaration**
1317
+~~~~
1318
+ uint32_t
1319
+ nm_get_ntp_servers(
1320
+     size_t \*pCount,
1321
+     char \*\*\*pppszNtpServers
1322
+ );
1323
+~~~~
1324
+**Arguments**
1325
+
1326
+- ``pCount`` - number of NTP servers in the pppszNtpServers array returned from the API call
1327
+- ``pppszNtpServers`` - array of NTP servers
1328
+
1329
+**Returns**
1330
+
1331
+- success: 0
1332
+- failure: error code
1333
+
1334
+Other APIs
1335
+
1336
+## nm_set_hostname
1337
+
1338
+**Description**
1339
+
1340
+Set the host name for the system.
1341
+
1342
+**Declaration**
1343
+~~~~
1344
+ uint32_t
1345
+ nm_set_hostname(
1346
+     const char \*pszHostname
1347
+ );
1348
+~~~~
1349
+**Arguments**
1350
+
1351
+- ``pszHostname`` - host name
1352
+
1353
+**Returns**
1354
+
1355
+- success: 0
1356
+- failure: error code
1357
+
1358
+## nm_get_hostname
1359
+
1360
+**Description**
1361
+
1362
+Get the host name for the system.
1363
+
1364
+**Declaration**
1365
+~~~~
1366
+ uint32_t
1367
+ nm_get_hostname(
1368
+     char \*\*ppszHostname
1369
+ );
1370
+~~~~
1371
+**Arguments**
1372
+
1373
+- ``ppszHostname`` - host name
1374
+
1375
+**Returns**
1376
+
1377
+- success: 0
1378
+- failure: error code
1379
+
1380
+## nm_wait_for_link_up
1381
+
1382
+**Description**
1383
+
1384
+Wait for the specified interface to come up.
1385
+
1386
+**Declaration**
1387
+~~~~
1388
+ uint32_t
1389
+ nm_wait_for_link_up(
1390
+     const char \*pszInterfaceName,
1391
+     uint32_t timeout
1392
+ );
1393
+~~~~
1394
+**Arguments**
1395
+
1396
+- ``pszInterfaceName`` - interface name
1397
+- ``timeout`` - maximum time (in seconds) to wait (until the link is up) before timing out of the request; specify 0 for no timeout (wait indefinitely)
1398
+
1399
+**Returns**
1400
+
1401
+- success: 0
1402
+- failure: error code
1403
+
1404
+## nm_wait_for_ip
1405
+
1406
+**Description**
1407
+
1408
+Wait for the interface to acquire an IP address of the specified IP address type.
1409
+
1410
+**Declaration**
1411
+~~~~
1412
+ uint32_t
1413
+ nm_wait_for_ip(
1414
+     const char \*pszInterfaceName,
1415
+     uint32_t timeout,
1416
+     NET_ADDR_TYPE addrTypes
1417
+ );
1418
+~~~~
1419
+**Arguments**
1420
+
1421
+- ``pszInterfaceName`` - interface name
1422
+- ``timeout`` - maximum time (in seconds) to wait (until the link has an IP address of the specified address type) before timing out of the request; specify 0 for no timeout (wait indefinitely)
1423
+- ``addrTypes`` - type of IP address; one of the following values:
1424
+  - ``STATIC_IPV4``
1425
+  - ``STATIC_IPV6``
1426
+  - ``DHCP_IPV4``
1427
+  - ``DHCP_IPV6``
1428
+  - ``AUTO_IPV6``
1429
+  - ``LINK_LOCAL_IPV6``
1430
+
1431
+**Returns**
1432
+
1433
+- success: 0
1434
+- failure: error code
1435
+
1436
+## nm_set_network_param
1437
+
1438
+**Description**
1439
+
1440
+Set the value of a network parameter for an object.
1441
+
1442
+**Declaration**
1443
+~~~~
1444
+uint32_t
1445
+ nm_set_network_param(
1446
+     const char \*pszObjectName,
1447
+     const char \*pszParamName,
1448
+     const char \*pszParamValue
1449
+ );
1450
+~~~~
1451
+**Arguments**
1452
+
1453
+- ``pszObjectName`` - an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf)
1454
+- ``pszParamName`` - name of a parameter associated with the object; specified in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html))
1455
+- ``pszParamValue`` - points to the parameter value to set; you can add (+) or remove (-) a parameter by prepending the parameter name with + or -. For example:
1456
+
1457
+netmgr net_info --set --object eth1 --paramname +Network_Address --paramvalue "10.10.10.1/24"
1458
+
1459
+**Returns**
1460
+
1461
+- success: 0
1462
+- failure: error code
1463
+
1464
+## nm_get_network_param
1465
+
1466
+**Description**
1467
+
1468
+Get the value of a network parameter associated with an object.
1469
+
1470
+**Declaration**
1471
+~~~~
1472
+ uint32_t
1473
+ nm_get_network_param(
1474
+     const char \*pszObjectName,
1475
+     const char \*pszParamName,
1476
+     char \*\*ppszParamValue
1477
+ );
1478
+~~~~
1479
+**Arguments**
1480
+
1481
+- ``pszObjectName`` - an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf)
1482
+- ``pszParamName`` - name of a parameter associated with the object; returned in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in  [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html))
1483
+- ``ppszParamValue`` - parameter value
1484
+
1485
+**Returns**
1486
+
1487
+- success: 0
1488
+- failure: error code
1489
+
1490
+# Service Management APIs
1491
+
1492
+## nm_stop_network_service
1493
+
1494
+**Description**
1495
+
1496
+Stop the network service.
1497
+
1498
+**Declaration**
1499
+~~~~
1500
+ uint32_t
1501
+ nm_stop_network_service();
1502
+~~~~
1503
+**Returns**
1504
+
1505
+- success: 0
1506
+- failure: error code
1507
+
1508
+## nm_restart_network_service
1509
+
1510
+**Description**
1511
+
1512
+Restart the network service.
1513
+
1514
+**Declaration**
1515
+~~~~
1516
+ uint32_t
1517
+ nm_restart_network_service();
1518
+~~~~
1519
+**Returns**
1520
+
1521
+- success: 0
1522
+- failure: error code
1523
+
1524
+nm_stop_dns_service
1525
+
1526
+**Description**
1527
+
1528
+Stop the DNS service.
1529
+
1530
+**Declaration**
1531
+~~~~
1532
+uint32_t
1533
+ nm_stop_dns_service();
1534
+~~~~
1535
+**Returns**
1536
+
1537
+- success: 0
1538
+- failure: error code
1539
+
1540
+## nm_restart_dns_service
1541
+
1542
+**Description**
1543
+
1544
+Restart the DNS service.
1545
+
1546
+**Declaration**
1547
+~~~~
1548
+ uint32_t
1549
+ nm_restart_dns_service();
1550
+~~~~
1551
+**Returns**
1552
+
1553
+- success: 0
1554
+- failure: error code
1555
+
1556
+## nm_stop_ntp_service
1557
+
1558
+**Description**
1559
+
1560
+Stop the NTP service.
1561
+
1562
+**Declaration**
1563
+~~~~
1564
+ uint32_t
1565
+ nm_stop_ntp_service();
1566
+~~~~
1567
+**Returns**
1568
+
1569
+- success: 0
1570
+- failure: error code
1571
+
1572
+## nm_restart_ntp_service
1573
+
1574
+**Description**
1575
+
1576
+Restart the NTP service.
1577
+
1578
+**Declaration**
1579
+~~~~
1580
+ uint32_t
1581
+ nm_restart_ntp_service();
1582
+~~~~
1583
+**Returns**
1584
+
1585
+- success: 0
1586
+- failure: error code
0 1587
\ No newline at end of file
1 1588
new file mode 100644
... ...
@@ -0,0 +1,786 @@
0
+# Network Configuration Manager - Python API
1
+
2
+Photon OS 2.0 provides a Python API for the Network Configuration Manager.
3
+
4
+- [Setup Instructions](#setup-instructions)
5
+- [Initialization Steps](#initialization-steps)
6
+- [Get Online Help](#get-online-help)
7
+- [Basic Information](#basic-information)
8
+- [Interface Configuration](#interface-configuration)
9
+- [IP Address Configuration](#ip-address-configuration)
10
+- [DNS Configuration](#dns-configuration)
11
+- [DHCP Options, DUID, and IAID Configuration](#dhcp-options-duid-and-iaid-configuration)
12
+- [NTP Servers](#ntp-servers)
13
+
14
+## Setup Instructions
15
+
16
+To set up and run the latest version of the Network Manager API for Python:
17
+
18
+````
19
+# tdnf install pmd pmd-python3
20
+# systemctl start pmd
21
+````
22
+
23
+## Initialization Steps
24
+
25
+````
26
+# python3
27
+>>> import pmd
28
+>>> net = pmd.server().net
29
+````
30
+## Get Online Help
31
+
32
+Get help for all commands.
33
+````
34
+>>> help(net)
35
+````
36
+Get help for a specific command.
37
+````
38
+>>> help(net.add_ntp_servers)
39
+-in function add_ntp_servers:
40
+add_ntp_servers(...) method of  [server.net](http://server.net/) instance
41
+    net.add_ntp_servers(ntpservers = ["20.20.20.20", "25.30.40.70"])
42
+    adds ntp servers. returns success: 0, failure: exception.
43
+(END)
44
+````
45
+
46
+## Basic Information
47
+
48
+### get_system_network_info
49
+
50
+Get network information details that are common to the entire system.
51
+
52
+**Syntax**
53
+
54
+````
55
+net.get_system_network_info()
56
+````
57
+**Returns**
58
+
59
+- details about the system network (DUID, DNS mode, DNS server list, DNS domain list, NTP server list)
60
+
61
+**Example**
62
+````
63
+>>> system_network_info = netmgmt.get_system_network_info()
64
+
65
+>>> print ( system_network_info)
66
+
67
+[{DUID: 00:02:11:22:33:44:55:66:77:20, DNS Mode: (null), DNS ServerList: ['10.10.100.100', '20.20.200.10'], DNS domain list: [' [abcd.com](http://abcd.com)'], NTP ServerList: (null)}]
68
+````
69
+
70
+### get_err_info
71
+
72
+Get information about the specified error number.
73
+
74
+**Syntax**
75
+````
76
+net.get_err_info(error = <error_number>)
77
+````
78
+**Parameters**
79
+
80
+- error - error number
81
+
82
+Here is the list of error numbers:
83
+
84
+- 4097 - invalid parameter
85
+- 4098 - not supported
86
+- 4099 - out of memory
87
+- 4100 - value not found
88
+- 4101 - value exists
89
+- 4102 - invalid interface
90
+- 4103 - invalid mode
91
+- 4104 - bad configuration file
92
+- 4105 - write failed
93
+- 4106 - timout
94
+- 4107 - DCHP timeout
95
+
96
+**Returns**
97
+
98
+- success: 0
99
+- failure: exception
100
+
101
+Example
102
+````
103
+>> net.get_err_info(error = 4097)
104
+
105
+'invalid parameter'
106
+````
107
+## Interface Configuration
108
+
109
+Use these commands to manage the configuration for a network interface.
110
+
111
+### get_link_info
112
+
113
+Get the link info for the specified interface or for all interfaces (if no interface is specified).
114
+
115
+**Syntax**
116
+````
117
+net.get_link_info(ifname = interface_name)
118
+````
119
+**Parameters**
120
+
121
+- ``ifname`` - interface name (optional)
122
+
123
+**Returns**
124
+
125
+- success: link info
126
+- failure: exception
127
+
128
+### get_link_macaddr
129
+
130
+Get the MAC address for the specified interface or for all interfaces (if no interface is specified).
131
+
132
+**Syntax**
133
+````
134
+net.get_link_macaddr(ifname = interface_name)
135
+````
136
+**Parameters**
137
+
138
+- ``ifname`` - interface name (optional)
139
+
140
+**Returns**
141
+
142
+- success: MAC address
143
+- failure: exception
144
+
145
+### get_link_mode
146
+
147
+Get the link mode for the specified interface (auto or manual), or for all interfaces (if no interface is specified).
148
+
149
+**Syntax**
150
+````
151
+net.get_link_mode(ifname = interface_name)
152
+````
153
+**Parameters**
154
+
155
+- ``ifname`` - interface name (optional)
156
+
157
+**Returns**
158
+
159
+- success: link mode (auto, manual, or unknown)
160
+- failure: exception
161
+
162
+### get_link_mtu
163
+
164
+Get the MTU of the specified interface or for all interfaces (if no interface is specified).
165
+
166
+**Syntax**
167
+````
168
+net.get_link_mtu(ifname = interface_name)
169
+````
170
+**Parameters**
171
+
172
+- ``ifname`` - interface name (optional)
173
+
174
+**Returns**
175
+
176
+- success: link MTU
177
+- failure: exception
178
+
179
+### get_link_state
180
+
181
+Get the link state of the specified interface or for all interfaces (if no interface is specified).
182
+
183
+**Syntax**
184
+````
185
+net.get_link_state(ifname = interface_name)
186
+````
187
+**Parameters**
188
+
189
+- ``ifname`` - interface name (optional)
190
+
191
+**Returns**
192
+
193
+- success: link state (up, down, unknown)
194
+- failure: exception
195
+
196
+### set_link_down
197
+
198
+Bring down the specified interface.
199
+
200
+**Syntax**
201
+
202
+````
203
+net.set_link_down(ifname = interface_name)
204
+````
205
+**Parameters**
206
+
207
+- ``ifname`` - interface name
208
+
209
+**Returns**
210
+
211
+- success: 0
212
+- failure: exception
213
+
214
+### set_link_macaddr
215
+
216
+Set the MAC address of the specified interface.
217
+
218
+**Syntax**
219
+````
220
+net.set_link_macaddr(ifname = interface_name, macaddr = mac_address)
221
+````
222
+**Parameters**
223
+
224
+- ``ifname`` - interface name
225
+- ``macaddr`` = MAC address
226
+
227
+**Returns**
228
+
229
+- success: 0
230
+- failure: exception
231
+
232
+### set_link_mode
233
+
234
+Set the mode (auto or manual) of the specifed interface.
235
+
236
+**Syntax**
237
+````
238
+net.set_link_mode(ifname = interface_name, link_mode = [auto, manual])
239
+````
240
+**Parameters**
241
+
242
+- ``ifname`` - interface name
243
+- ``link_mode`` - auto or manual
244
+
245
+**Returns**
246
+
247
+- success: 0
248
+- failure: exception
249
+
250
+### set_link_mtu
251
+
252
+Set the MTU for the specified interface.
253
+
254
+**Syntax**
255
+````
256
+net.set_link_mtu(ifname = interface_name, mtu = mtu)
257
+````
258
+**Parameters**
259
+
260
+- ``ifname`` - interface name
261
+- ``mtu`` - ``mtu``
262
+
263
+**Returns**
264
+
265
+- success: 0
266
+- failure: exception
267
+
268
+### set_link_state
269
+
270
+Set the state (up or down) of the specified interface.
271
+
272
+**Syntax**
273
+````
274
+net.set_link_state(ifname = interface_name, link_state = [down, up])
275
+````
276
+**Parameters**
277
+
278
+- ``ifname`` - interface name
279
+- ``link_state`` - down or up
280
+
281
+**Returns**
282
+
283
+- success: 0
284
+- failure: exception
285
+
286
+### set_link_up
287
+
288
+Brings up the specified interface.
289
+
290
+**Syntax**
291
+````
292
+net.set_link_up(ifname = interface_name)
293
+````
294
+**Parameters**
295
+
296
+- ``ifname`` - interface name
297
+- ``link_state`` - down or up
298
+
299
+**Returns**
300
+
301
+- success: 0
302
+- failure: exception
303
+
304
+## IP Address Configuration
305
+
306
+Use these commands to manage IP address configuration for a network interface.
307
+
308
+### add_static_ipv6_addr
309
+
310
+Add a static IPv6 address to the specified interface.
311
+
312
+**Syntax**
313
+````
314
+net.add_static_ipv6_addr(ifname = interface_name, addr_prefix = ipv6address_prefix)
315
+````
316
+**Parameters**
317
+
318
+- ``ifname`` - interface name
319
+- ``addr_prefix`` - IPv6 address prefix
320
+
321
+**Returns**
322
+
323
+- success: 0
324
+- failure: exception
325
+
326
+### del_static_ipv6_addr
327
+
328
+Delete a static IPv6 address from the specified interface.
329
+
330
+**Syntax**
331
+````
332
+net.del_static_ipv6_addr(ifname = interface_name, addr_prefix = ipv6address_prefix)
333
+````
334
+**Parameters**
335
+
336
+- ``ifname`` - interface name
337
+- ``addr_prefix`` - IPv6 address prefix
338
+
339
+**Returns**
340
+
341
+- success: 0
342
+- failure: exception
343
+
344
+### get_ipv4_addr_gateway
345
+
346
+Get the IPv4 address with the prefix and gateway for the specified interface.
347
+
348
+**Syntax**
349
+````
350
+net.get_ipv4_addr_gateway(ifname = interface_name)
351
+````
352
+**Parameters**
353
+
354
+- ``ifname`` - interface name
355
+
356
+**Returns**
357
+
358
+- success: IPv4 address with the prefix and gateway
359
+- failure: exception
360
+
361
+### get_ipv6_addr
362
+
363
+Get the list of IPv6 addresses for the specified interface.
364
+
365
+**Syntax**
366
+````
367
+net.get_ipv6_addr(ifname = interface_name)
368
+````
369
+**Parameters**
370
+
371
+- ``ifname`` - interface name
372
+
373
+**Returns**
374
+
375
+- success: IPv6 address list
376
+- failure: exception
377
+
378
+### get_ipv6_addr_mode
379
+
380
+Get the address mode for the specified interface to determine whether DHCPv6, autoconf are enabled or disabled.
381
+
382
+**Syntax**
383
+````
384
+net.get_ipv6_addr_mode(ifname = interface_name)
385
+````
386
+**Parameters**
387
+
388
+- ``ifname`` - interface name
389
+
390
+**Returns**
391
+
392
+- Status for DHCPv6, autoconf (True=enabled, False=disabled)
393
+- failure: exception
394
+
395
+### get_ipv6_gateway
396
+
397
+Get the IPv6 gateway for the specified interface.
398
+
399
+**Syntax**
400
+````
401
+net.get_ipv6_gateway(ifname = interface_name)
402
+````
403
+**Parameters**
404
+
405
+- ``ifname`` - interface name
406
+
407
+**Returns**
408
+
409
+- success: IPv6 gateway
410
+- failure: exception
411
+
412
+### set_ipv4_addr_gateway
413
+
414
+Set the IPv4 address with the prefix and gateway for the specified interface.
415
+
416
+**Syntax**
417
+````
418
+net.get_ipv4_addr_gateway(ifname = interface_name, addr_mode = [dhcp, static, none], addr_prefix = ipv4addressprefix, gateway = ipv4gateway)
419
+````
420
+**Parameters**
421
+
422
+- ``ifname`` - interface name
423
+- ``addr_mode`` - address mode - dhcp, static, or none
424
+- ``addr_prefix`` -  IPv4 address or prefix
425
+- ``gateway`` - IPv4 gateway
426
+
427
+**Returns**
428
+
429
+- success: 0
430
+- failure: exception
431
+
432
+### set_ipv6_addr_mode
433
+
434
+Set the address mode for the specified interface.
435
+
436
+**Syntax**
437
+````
438
+net.set_ipv6_addr_mode(ifname = interface_name, enable_dhcp = [True, False], enable_autoconf = [True, False])
439
+````
440
+**Parameters**
441
+
442
+- ``ifname`` - interface name
443
+- ``enable_dhcp`` - True to enable, False to disable
444
+- ``enable_autoconf`` - True to enable, False to disable
445
+
446
+**Returns**
447
+
448
+- success: 0
449
+- failure: exception
450
+
451
+### set_ipv6_gateway
452
+
453
+Set the IPv6 gateway for the specified interface.
454
+
455
+**Syntax**
456
+````
457
+net.set_ipv6_gateway(ifname = interface_name, gateway = ipv6gateway)
458
+````
459
+**Parameters**
460
+
461
+- ``ifname`` - interface name
462
+- ``gateway`` - IPv6 gateway
463
+
464
+**Returns**
465
+
466
+- success: 0
467
+- failure: exception
468
+
469
+## DNS Configuration
470
+
471
+Use these commands to manage DNS domains and servers for a network interface.
472
+
473
+### get_dns_domains
474
+
475
+Get the list of DNS domains for the specified interface.
476
+
477
+**Syntax**
478
+````
479
+net.get_dns_domains(ifname = interface_name)
480
+````
481
+**Parameters**
482
+
483
+- ``ifname`` - interface name
484
+
485
+**Returns**
486
+
487
+- success: list of DNS domains
488
+- failure: exception
489
+
490
+### get_dns_servers
491
+
492
+Get the list of DNS servers and the mode for the specified interface.
493
+
494
+**Syntax**
495
+````
496
+net.get_dns_servers(ifname = interface_name)
497
+````
498
+**Parameters**
499
+
500
+- ``ifname`` - interface name
501
+
502
+**Returns**
503
+
504
+- success: list of DNS servers and mode
505
+- failure: exception
506
+
507
+### set_dns_domains
508
+
509
+Set the list of DNS domains for the specified interface.
510
+
511
+**Syntax**
512
+````
513
+net.set_dns_domains(domains = ["domain1","domain2",...], ifname = interface_name)
514
+````
515
+**Parameters**
516
+
517
+- ``domains`` - comma-separated list of one or more domains
518
+- ``ifname`` - interface name
519
+
520
+**Returns**
521
+
522
+- success: 0
523
+- failure: exception
524
+
525
+### set_dns_servers
526
+
527
+Set the list of DNS servers for the specified interface.
528
+
529
+**Syntax**
530
+````
531
+net.set_dns_servers(dns_mode = [dhcp, static], servers = ["server1","server2", ...], ifname = interface_name)
532
+````
533
+**Parameters**
534
+
535
+- ``dns_mode`` - dhcp or static
536
+- ``servers`` - comma-separate list of one or more servers
537
+- ``ifname`` - interface name
538
+
539
+**Returns**
540
+
541
+- success: 0
542
+- failure: exception
543
+
544
+## DHCP Options DUID and IAID Configuration
545
+
546
+### get_link_iaid
547
+
548
+Get the IAID for the specified interface.
549
+
550
+**Syntax**
551
+````
552
+net.get_link_iaid(ifname = interface)
553
+````
554
+**Parameters**
555
+
556
+- ``ifname`` - interface name
557
+
558
+**Returns**
559
+
560
+- success: IAID
561
+- failure: exception
562
+
563
+### set_link_iaid
564
+
565
+Set the IAID for the specified interface.
566
+
567
+**Syntax**
568
+````
569
+net.set_link_iaid(ifname = interface_name, iaid = <iaid>)
570
+````
571
+**Parameters**
572
+
573
+- ``ifname`` - interface name
574
+- iaid - IAID
575
+
576
+**Returns**
577
+
578
+- success: 0
579
+- failure: exception
580
+
581
+### get_dhcp_duid
582
+
583
+Get the DCHP DUID.
584
+
585
+**Syntax**
586
+````
587
+net.get_dhcp_duid(ifname = interface_name)
588
+````
589
+**Parameters**
590
+
591
+- ``ifname`` - interface name (optional)
592
+
593
+**Returns**
594
+
595
+- success: DUID
596
+- failure: exception
597
+
598
+### set_dhcp_duid
599
+
600
+Set the DCHP DUID.
601
+
602
+**Syntax**
603
+````
604
+net.set_dhcp_duid(ifname = interface_name duid = duid)
605
+````
606
+**Parameters**
607
+
608
+- ``ifname`` - interface name (optional)
609
+- ``duid`` - DUID to set
610
+
611
+**Returns**
612
+
613
+- success: 0
614
+- failure: exception
615
+
616
+## NTP Servers
617
+
618
+Use these commands to manage the NTP servers list.
619
+
620
+### add_ntp_servers
621
+
622
+Add one or more NTP servers to the NTP servers list.
623
+
624
+**Syntax**
625
+````
626
+net.add_ntp_servers(ntpservers = ["server1", "server2", ...])
627
+````
628
+**Parameters**
629
+
630
+- ``ntpservers`` - Comma-separated list of NTP servers to add to the list.
631
+
632
+**Returns**
633
+
634
+- success: 0
635
+- failure: exception
636
+
637
+### del_ntp_servers
638
+
639
+Remove one or more NTP servers from the NTP servers list.
640
+
641
+**Syntax**
642
+````
643
+net.del_ntp_servers(ntpservers = ["server1", "server2", ...])
644
+````
645
+**Parameters**
646
+
647
+- ``ntpservers`` - Comma-separated list of NTP servers to remove from the list.
648
+
649
+**Returns**
650
+
651
+- success: 0
652
+- failure: exception
653
+
654
+### get_ntp_servers
655
+
656
+Get the NTP servers list.
657
+
658
+**Syntax**
659
+````
660
+net.get_ntp_servers()
661
+````
662
+**Returns**
663
+
664
+- success: NTP servers list
665
+- failure: exception
666
+
667
+### set_ntp_servers
668
+
669
+Set the NTP servers list.
670
+
671
+**Syntax**
672
+````
673
+net.set_ntp_servers(ntpservers = ["server1", "server2", ...])
674
+````
675
+**Parameters**
676
+
677
+- ``ntpservers`` - Comma-separated list of NTP servers to set in the list.
678
+
679
+**Returns**
680
+
681
+- success: 0
682
+- failure: exception
683
+
684
+### get_hostname
685
+
686
+Get the host name.
687
+
688
+**Syntax**
689
+
690
+net.get_hostname()
691
+
692
+**Returns**
693
+
694
+- success: host name
695
+- failure: exception
696
+
697
+### set_hostname
698
+
699
+Set the host name.
700
+
701
+**Syntax**
702
+````
703
+net.set_hostname(hostname)
704
+````
705
+**Parameters**
706
+
707
+- ``hostname`` - name to assign to the host
708
+
709
+**Returns**
710
+
711
+- success: 0
712
+- failure: exception
713
+
714
+### wait_for_ip
715
+
716
+Wait for the specified interface to acquire a valid IP address of the specified IP address type.
717
+
718
+**Syntax**
719
+````
720
+net.wait_for_ip(ifname = interface_name, timeout = timeout, addrtypes = [ipv4, ipv6, static_ipv4, static_ipv6, dhcp_ipv4, dhcp_ipv6, auto_ipv6, link_local_ipv6])
721
+````
722
+**Parameters**
723
+
724
+- ``ifname`` - interface name
725
+- ``timeout`` - maximum time (in seconds) to wait (until the link is up) before timing out of the request; specify 0 for no timeout (wait indefinitely)
726
+- ``addrtypes`` - one of the following address types: ipv4, ipv6, static_ipv4, static_ipv6, dhcp_ipv4, dhcp_ipv6, auto_ipv6, or link_local_ipv6
727
+
728
+**Returns**
729
+
730
+- success: 0 (when the link has an IP of the specified type)
731
+- failure: exception (for example, timeout expired)
732
+
733
+### wait_for_link_up
734
+
735
+Wait for the specified interface to come up.
736
+
737
+**Syntax**
738
+````
739
+net.wait_for_link_up(ifname = interface_name, timeout = timeout)
740
+````
741
+**Parameters**
742
+
743
+- ``ifname`` - interface name
744
+- ``timeout`` - maximum time (in seconds) to wait (until the link is up) before timing out of the request; specify 0 for no timeout (wait indefinitely)
745
+
746
+**Returns**
747
+
748
+- success: 0 (when link is up)
749
+- failure: exception (for example, timeout expired)
750
+
751
+### get_network_param
752
+
753
+Get the specified network configuration parameter for the specified interface or filename.
754
+
755
+**Syntax**
756
+````
757
+net.get_network_param(object = IfName or Filename, paramname = SectionName_KeyName)
758
+````
759
+**Parameters**
760
+
761
+- ``object`` - an interface name (for example, &quot;eth0&quot;) or a file name (for example, /etc/systemd/resolved.conf)
762
+- ``paramname`` - name of a parameter associated with the object; specified in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in  [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html))
763
+
764
+**Returns**
765
+
766
+- success: 0
767
+- failure: exception
768
+
769
+### set_network_param
770
+
771
+Set the value of a network configuration parameter for the specified interface or filename.
772
+
773
+**Syntax**
774
+````
775
+net.set_network_param(object = interface_name or filename, paramname = SectionName_KeyName, paramvalue = key_value)
776
+````
777
+**Parameters**
778
+
779
+- ``object`` - an interface name (for example, &quot;eth0&quot;) or a file name (for example, /etc/systemd/resolved.conf)
780
+- ``paramname`` - name of a parameter associated with the object; specified in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in  [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html))
781
+
782
+**Returns**
783
+
784
+- success: 0
785
+- failure: exception
0 786
new file mode 100644
... ...
@@ -0,0 +1,25 @@
0
+# Options for Commands
1
+
2
+You can add the following options to `tdnf` commands. If the option to override a configuration is unavailable in a command, you can add it to the `/etc/tdnf/tdnf.conf` configuration file.
3
+
4
+	OPTION                     DESCRIPTION
5
+	--allowerasing             Allow erasing of installed packages to resolve dependencies
6
+	--assumeno                 Answer no for all questions
7
+	--best                     Try the best available package versions in transactions
8
+	--debugsolver              Dump data aiding in dependency solver debugging info.
9
+	--disablerepo=<repoid>     Disable specific repositories by an id or a glob.
10
+	--enablerepo=<repoid>      Enable specific repositories
11
+	-h, --help                 Display help
12
+	--refresh                  Set metadata as expired before running command
13
+	--nogpgcheck               Skip gpg check on packages
14
+	--rpmverbosity=<debug level name>
15
+	                           Debug level for rpm
16
+	--version                  Print version and exit
17
+	-y, --assumeyes            Answer yes to all questions
18
+	-q, --quiet                Quiet operation
19
+
20
+The following is an example that adds the short form of the `assumeyes` option to the install command:
21
+
22
+	tdnf -y install gcc
23
+	Upgrading:
24
+	gcc 	x86_64	5.3.0-1.ph1 	91.35 M
0 25
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+# Photon OS Package Repositories
1
+
2
+The default installation of Photon OS includes four yum-compatible repositories plus the repository on the Photon OS ISO when it's available in a CD-ROM drive:  
3
+
4
+    ls /etc/yum.repos.d/
5
+    lightwave.repo
6
+    photon-extras.repo
7
+    photon-iso.repo
8
+    photon-updates.repo
9
+    photon.repo 
10
+
11
+The Photon ISO repository (`photon-iso.repo`) contains the installation packages for Photon OS. All the packages that Photon builds and publishes reside in the RPMs directory of the ISO when it is mounted. The RPMs directory contains metadata that lets it act as a yum repository. Mounting the ISO gives you all the packages corresponding to a Photon OS build. If, however, you built Photon OS yourself from the source code, the packages correspond only to your build, though they will typically be the latest. In contrast, the ISO that you obtain from the Bintray web site contains only the packages that are in the ISO at the point of publication. As a result, the packages may no longer match those on Bintray, which are updated regularly.  
12
+
13
+The main Photon OS repository (`photon.repo`) contains all the packages that are built from the ISO or from another source. This repository points to a static batch of packages and spec files at the point of a release. 
14
+
15
+The updates repository (`photon-updates.repo`) is irrelevant to a major release until after the release is installed. Thereafter, the updates repository holds the updated packages for that release. The repository, that is, points to updates for the installed version, such as a version of Kubernetes that supersedes the version installed during the major release. 
16
+
17
+The Photon extras repository (`photon-extras.repo`) holds Likewise Open, an open source authentication engine, and other VMware software that you can add to Photon OS for free. Photon OS supports but does not build the packages in the extras repository.  
18
+Similarly, the Lightwave repository (`lightwave.repo`) contains the packages that make up the VMware Lightwave security suite for cloud applications, including tools for identity management, access control, and certificate management.
0 19
new file mode 100644
... ...
@@ -0,0 +1,486 @@
0
+# Photon Management Daemon Command-line Interface (pmd-cli)
1
+
2
+Photon OS 2.0 provides the Photon Management Daemon command line interface (pmd-cli).
3
+
4
+- [Setup Steps](#setup-steps)
5
+- [Syntax](#syntax)
6
+- [Firewall Management](#firewall-management)
7
+- [Network Management](#network-management)
8
+- [Package Management](#package-management)
9
+- [User Management](#user-management)
10
+
11
+# Setup Steps
12
+
13
+The pmd-cli utility is included with your Photon OS 2.0 distribution. To make sure that you have the latest version, you can run:
14
+~~~~
15
+tdnf install pmd-cli
16
+~~~~
17
+# Syntax
18
+~~~~
19
+pmd-cli [connection_auth_options] <component> <command> [command_options]
20
+~~~~
21
+Passed-in parameter values can be enclosed in single (&#39;) or double-quotes (&quot;) as long as you use matching characters to denote the beginning and end of the value. Unless a parameter value contains special characters or spaces, you can also omit quotes altogether.
22
+
23
+## Connection / Authorization Options
24
+
25
+### Local Connections
26
+
27
+For local connections, you omit the connection and authorization options:
28
+~~~~
29
+pmd-cli <component> <cmd> <options>
30
+~~~~
31
+Permissions for the currently logged-in user apply when executing commands. This is the same as specifying --servername localhost.
32
+
33
+### Remote Connections
34
+
35
+For connecting to a remote server (a server other than the local server), you specify two connection / authorization options:
36
+
37
+- ``--servername``: name of the server
38
+- ``--user``: username of a user account on the server
39
+
40
+**Note:**  For authentication, you can specify the username (–user &lt;username&gt;) on the command line, but never the password. For security reasons, the system must prompt you for the password.
41
+
42
+What follows are three options for remote connections.
43
+
44
+**System User**
45
+~~~~
46
+pmd-cli --servername <server> --user <username>
47
+~~~~
48
+**Lightwave User**
49
+
50
+Before using this method, the pmd server must be joined or should be part of embedded Lightwave.
51
+~~~~
52
+pmd-cli --servername <server> --user <username> --domain <lightwave_domain>
53
+~~~~
54
+**Kerberos spn**
55
+
56
+Before using this method, the client must run kinit successfully.
57
+~~~~
58
+pmd-cli --servername <server> --spn <service_principal_name>
59
+~~~~
60
+## Component
61
+
62
+``<component>`` is one of the following values:
63
+
64
+- ``firewall``
65
+- ``net``
66
+- ``pkg``
67
+- ``usr``
68
+
69
+# Firewall Management
70
+
71
+The Photon Management Daemon provides CLI commands to help you get information about the firewall.
72
+
73
+## Syntax
74
+~~~~
75
+pmd-cli [connection_auth_options] firewall <command> [command_options]
76
+~~~~
77
+## firewall help
78
+
79
+Get help for firewall CLI commands.
80
+~~~~
81
+pmd-cli firewall help
82
+~~~~
83
+## firewall rules
84
+
85
+Get a list of the current persistent firewall rules.
86
+~~~~
87
+pmd-cli firewall rules [command-options]
88
+~~~~
89
+This command returns information about each firewall rule, such as the chain to which it belongs, the policy to enforce, the table to manipulate, and so on.
90
+
91
+Add a new firewall rule.
92
+~~~~
93
+pmd-cli firewall rules --chain <chain_name> --add <rule_specification>
94
+~~~~
95
+Example:
96
+~~~~
97
+pmd-cli firewall rules --chain INPUT --add "-p tcp -m tcp --dport 21 -j ACCEPT"
98
+~~~~
99
+**Note:** To confirm that the firewall rule was added, run iptables -S. Running pmd-cli firewall rules lists only persistent rules.
100
+
101
+Delete a new firewall rule.
102
+~~~~
103
+pmd-cli firewall rules --chain <chain_name> --delete <rule_specification>
104
+~~~~
105
+**Note:**  To confirm that the firewall rule was removed, run iptables -S. Running pmd-cli firewall rules lists only persistent rules.
106
+
107
+Make firewall rule changes peristent (add --persist flag)
108
+~~~~
109
+pmd-cli firewall rules --chain <chain_name> --add <rule_specification> --persist
110
+~~~~
111
+
112
+## firewall version
113
+
114
+Get the version number of the fwmgmt component on the server.
115
+~~~~
116
+pmd-cli firewall version
117
+~~~~
118
+# Network Management
119
+
120
+The Photon Management Daemon provides CLI commands to help you manage network interfaces.
121
+
122
+## Syntax
123
+~~~~
124
+pmd-cli [connection_auth_options] net <command> [command_options]
125
+~~~~
126
+Many of these commands require the interface name (–interface &lt;ifname&gt;). Command options are described below.
127
+
128
+## net link_info
129
+
130
+Get the mac address, mtu, link state, and link mode for the specified interface.
131
+~~~~
132
+pmd-cli net link_info --get --interface <ifname>
133
+~~~~
134
+Set the MAC address, mode (manual or auto), link state (up or down), link mode (manual or auto), and MTU for the specified interface.
135
+~~~~
136
+pmd-cli net link_info --set --interface <ifname> --macaddr <mac_address> --mode <manual|auto> --state <up|down> --mtu <mtu>
137
+~~~~
138
+## net ip4_address
139
+
140
+Get the IPv4 address for the specified interface.
141
+~~~~
142
+pmd-cli net ip4_address --get --interface <ifname>
143
+~~~~
144
+Set the IPv4 address (dot-decimal/prefix notation), mode (dhcp, static, or none), and (optionally) the default gateway for the specified interface.
145
+~~~~
146
+pmd-cli net ip4_address --set --interface <ifname> --mode <dhcp|static|none> --addr <IPv4Address/prefix> --gateway <gateway_address>
147
+~~~~
148
+## net ip6_address
149
+
150
+Get IPv6 address(es) for the specified interface.
151
+~~~~
152
+pmd-cli net ip6_address --get --interface <ifname>
153
+~~~~
154
+Add one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) to the specified interface.
155
+~~~~
156
+pmd-cli net ip6_address --add --interface <ifname> --addrlist <IPv6Addr1/prefix,IPv6Addr2/prefix,...>
157
+~~~~
158
+Delete one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) from the specified interface.
159
+~~~~
160
+pmd-cli net ip6_address --del --interface <ifname> --addrlist <IPv6Addr1/prefix,IPv6Addr2/prefix,...>
161
+~~~~
162
+Set the DHCP mode (1=enable, 0=disable) and autoconfigure settings (1=enable, 0=disable) for the specified interface.
163
+~~~~
164
+pmd-cli net ip6_address --set --interface <ifname> --dhcp <1|0> --autoconf <1|0>
165
+~~~~
166
+## net ip_route
167
+
168
+Get the static IP route for the specified interface.
169
+~~~~
170
+pmd-cli net ip_route --get --interface <ifname>
171
+~~~~
172
+Add the static IP route (gateway IP, destination network, and metric) to the specified interface.
173
+~~~~
174
+pmd-cli net ip_route --add --interface <ifname> --gateway <GatewayIP> --destination <DestinationNetwork/prefix> --metric <N>
175
+~~~~
176
+Delete the specified static IP route from the specified interface.
177
+~~~~
178
+pmd-cli net ip_route --del --interface <ifname> --destination <DestinationNetwork/prefix>
179
+~~~~
180
+## net dns_servers
181
+
182
+Get the list of DNS servers.
183
+~~~~
184
+pmd-cli net dns_servers --get
185
+~~~~
186
+Set the DNS mode (dhcp or static) for one or more DNS servers (comma-separated list).
187
+~~~~
188
+pmd-cli net dns_servers --set --mode <dhcp|static> --servers <server1,server2,...>
189
+~~~~
190
+Add a DNS server to the list of DNS servers.
191
+~~~~
192
+pmd-cli net dns_servers --add --servers <server>
193
+~~~~
194
+Remove the specified DNS server from the list of DNS servers.
195
+~~~~
196
+pmd-cli net dns_servers --del --servers <server>
197
+~~~~
198
+## net dns_domains
199
+
200
+Get the list of DNS domains.
201
+~~~~
202
+pmd-cli net dns_domains --get
203
+~~~~
204
+Set the list of DNS domains (one or more DNS domains in a comma-separated list).
205
+~~~~
206
+pmd-cli net dns_domains --set --domains <domain1,domain2,...>
207
+~~~~
208
+Add a DNS domain to the list of DNS domains.
209
+~~~~
210
+pmd-cli net dns_domains --add --domains <domain1>
211
+~~~~
212
+Delete a DNS domain from the list of DNS domains.
213
+~~~~
214
+pmd-cli net dns_domains --del --domains <domain1>
215
+~~~~
216
+## net dhcp_duid
217
+
218
+Get the DHCP DUID (optionally interface-specific DUID) for the system.
219
+~~~~
220
+pmd-cli net dhcp_duid --get
221
+~~~~
222
+Set the DHCP DUID for the system, optionally per-interface if the interface is specified.
223
+~~~~
224
+pmd-cli net dhcp_duid --set --duid <duid>
225
+~~~~
226
+## net if_iaid
227
+
228
+Get the IAID for the specified interface.
229
+~~~~
230
+pmd-cli net if_iaid --get --interface <ifname>
231
+~~~~
232
+Set the IAID for the specified interface.
233
+~~~~
234
+pmd-cli net if_iaid --set --interface <ifname> --iaid <iaid>
235
+~~~~
236
+## net ntp_servers
237
+
238
+Get the NTP servers list.
239
+~~~~
240
+pmd-cli net ntp_servers --get
241
+~~~~
242
+Set the NTP servers list.
243
+~~~~
244
+pmd-cli net ntp_servers --set --servers <server1,server2,...>
245
+~~~~
246
+Add the specified server to the NTP servers list.
247
+~~~~
248
+pmd-cli net ntp_servers --add --servers <server>
249
+~~~~
250
+Delete the specified server from the NTP servers list.
251
+~~~~
252
+pmd-cli net ntp_servers --del --servers <server>
253
+~~~~
254
+## net hostname
255
+
256
+Get the system hostname.
257
+~~~~
258
+pmd-cli net hostname --get
259
+~~~~
260
+Set the system hostname.
261
+~~~~
262
+pmd-cli net hostname --set --name <hostname>
263
+~~~~
264
+## net wait_for_link
265
+
266
+Wait for the specified network interface to be up and usable (it can send and receive packets).
267
+~~~~
268
+pmd-cli net wait_for_link --interface <ifname> --timeout <timeout>
269
+~~~~
270
+The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
271
+
272
+**Note:** You might need to use net wait_for_ip to wait until you can send and receive IP packets.
273
+
274
+## net wait_for_ip
275
+
276
+Wait for the specified interface to acquire a valid IP address for the specified address type.
277
+~~~~
278
+pmd-cli net wait_for_ip --interface <ifname> --timeout <timeout> --addrtype <ipv4,ipv6,static_ipv4,static_ipv6,dhcp_ipv4,dhcp_ipv6,auto_ipv6,link_local_ipv6>
279
+~~~~
280
+The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
281
+
282
+## net error_info
283
+
284
+Get error information about the specified error code.
285
+~~~~
286
+pmd-cli net error_info --errcode <error_code>
287
+~~~~
288
+Here is a list of error codes:
289
+
290
+- 4097 - invalid parameter
291
+- 4098 - not supported
292
+- 4099 - out of memory
293
+- 4100 - value not found
294
+- 4101 - value exists
295
+- 4102 - invalid interface
296
+- 4103 - invalid mode
297
+- 4104 - bad configuration file
298
+- 4105 - write failed
299
+- 4106 - timout
300
+- 4107 - DCHP timeout
301
+
302
+## net net_info
303
+
304
+Get the specified network configuration parameter for the specified object.
305
+~~~~
306
+pmd-cli net net_info --get --object <ifname or filename> --paramname <param_name>
307
+~~~~
308
+**Note:** The object can be an interface name (for example, &quot;eth0&quot;) or a file name (for example, /etc/systemd/resolved.conf).
309
+
310
+Set the value of the specified network configuration parameter for the specified object (interface or file).
311
+~~~~
312
+pmd-cli net net_info --set --object <ifname or filename> --paramname <param_name> --paramvalue <param_value>
313
+~~~~
314
+**Note** : You can add (+) or remove (-) a parameter by prepending the parameter name with + or -.
315
+
316
+# Package Management
317
+
318
+The Photon Management Daemon provides CLI commands to help you manage packages and repositories.
319
+
320
+## Syntax
321
+~~~~
322
+pmd-cli [connection options] pkg <command> [command options]
323
+~~~~
324
+If a command allows for multiple package names, simply specify on the command line, separated by spaces.
325
+~~~~
326
+pmd-cli pkg info <package_name_1> <package_name_2> <package_name_3> ...
327
+~~~~
328
+## pkg help
329
+
330
+Get help text for pkg CLI commands.
331
+~~~~
332
+pmd-cli pkg help
333
+~~~~
334
+## pkg count
335
+
336
+Get the total number of packages in all repos (including installed).
337
+~~~~
338
+pmd-cli pkg count
339
+~~~~
340
+## pkg distro-sync
341
+
342
+Synchronize installed packages to the latest available versions. If no packages are specified, then all available packages are synchronized.
343
+~~~~
344
+pmd-cli pkg distro-sync
345
+~~~~
346
+## pkg downgrade
347
+
348
+Downgrade the specified package(s). If no packages are specified, then all available packages are downgraded.
349
+~~~~
350
+pmd-cli pkg downgrade <package_name>
351
+~~~~
352
+## pkg erase
353
+
354
+Remove the specified package(s).
355
+~~~~
356
+pmd-cli pkg erase <package_name>
357
+~~~~
358
+## pkg info
359
+
360
+Get general information about the specified package(s),  such as name, version, release, repository, install size, and so on.
361
+~~~~
362
+pmd-cli pkg info <package_name>
363
+~~~~
364
+If no packages are specified, then this command returns information about all packages.
365
+~~~~
366
+## pkg install
367
+~~~~
368
+Install the specified package(s). Update the package if an update is available.
369
+~~~~
370
+pmd-cli pkg install <package_name>
371
+~~~~
372
+## pkg list
373
+
374
+Get a list of packages or groups of packages.
375
+~~~~
376
+pmd-cli pkg list
377
+~~~~
378
+You can filter by group: all, available, installed, extras, obsoletes, recent, and upgrades.
379
+~~~~
380
+pmd-cli pkg list upgrades
381
+~~~~
382
+You can also filter by wildcards.
383
+~~~~
384
+pmd-cli pkg list ph\*
385
+~~~~
386
+## pkg reinstall
387
+
388
+Reinstall the specified package(s).
389
+~~~~
390
+pmd-cli pkg reinstall <package_name>
391
+~~~~
392
+## pkg repolist
393
+
394
+Get a list of the configured software repositories.
395
+~~~~
396
+pmd-cli pkg repolist
397
+~~~~
398
+This command returns a list of the configured software repositories, including the repository ID, repitory name, and status.
399
+
400
+## pkg update
401
+
402
+Update the specified package(s).
403
+~~~~
404
+pmd-cli pkg update <package_name>
405
+~~~~
406
+If no parameters are specified, then all available packages are updated.
407
+
408
+## pkg updateinfo
409
+
410
+Get the update information on all enabled repositories (status = enabled). If this command returns nothing, then the update information may not exist on the server.
411
+~~~~
412
+pmd-cli pkg updateinfo
413
+~~~~
414
+# User Management
415
+
416
+The Photon Management Daemon provides CLI commands to help you manage users and user groups.
417
+
418
+## Syntax
419
+~~~~
420
+pmd-cli [connection options] usr <command> [command options]
421
+~~~~
422
+## usr help
423
+
424
+Display help text for user commands.
425
+~~~~
426
+pmd-cli usr users
427
+~~~~
428
+## usr users
429
+
430
+Get a list of users. This command returns information about each user, including their user name, user ID, user group (if applicable), home directory, and default shell.
431
+~~~~
432
+pmd-cli usr users
433
+~~~~
434
+## usr useradd
435
+
436
+Add a new user. Specify the username.
437
+~~~~
438
+pmd-cli usr useradd <username>
439
+~~~~
440
+The system assigns a user ID, home directory, and default shell to the new user. The user group is unspecified.
441
+
442
+## usr userdel
443
+
444
+Delete the specified user.
445
+~~~~
446
+pmd-cli usr userdel <username>
447
+~~~~
448
+## usr userid
449
+
450
+Get the user ID of the specified user (by name). Used to determine whether the specified user exists.
451
+~~~~
452
+pmd-cli usr userid <username>
453
+~~~~
454
+## usr groups
455
+
456
+Get a list of user groups. This command returns the following information about each user group: user group name and user group ID.
457
+~~~~
458
+pmd-cli usr groups
459
+~~~~
460
+## usr groupadd
461
+
462
+Add a new user group.
463
+~~~~
464
+pmd-cli usr groupadd <user_group_name>
465
+~~~~
466
+The system assigns a group ID to the new user group.
467
+
468
+## usr groupdel
469
+
470
+Delete the specified user group.
471
+~~~~
472
+pmd-cli usr groupdel <user_group_name>
473
+~~~~
474
+## usr groupid
475
+
476
+Get the group ID for the specified user group (by name). Used to determine whether the specified user group exists.
477
+~~~~
478
+pmd-cli usr groupid <user_group_name>
479
+~~~~
480
+## usr version
481
+
482
+Get the version of the usermgmt component at the server.
483
+~~~~
484
+pmd-cli usr version
485
+~~~~
0 486
new file mode 100644
... ...
@@ -0,0 +1,5 @@
0
+# The Root Account and the `sudo` and `su` Commands
1
+
2
+The *Photon OS Administration Guide* assumes that you are logged in to Photon OS with the root account and running commands as root. The `sudo` program contains the full version of Photon OS. 
3
+
4
+On the minimal version, you must install `sudo` with tdnf if you want to use it. As an alternative to installing `sudo`, to run commands that require root privileges you can switch users as needed with the `su` command.
0 5
\ No newline at end of file
1 6
new file mode 100644
... ...
@@ -0,0 +1,34 @@
0
+# Running a Photon OS Machine on GCE
1
+
2
+Photon OS comes in a preconfigured image ready for Google Cloud Engine. This section demonstrates how to create a Photon OS instance on Google Cloud Engine with and without cloud-init user data.
3
+
4
+This section assumes that you have set up a GCE account and, if you try the examples, are ready to pay Google for its cloud services. The GCE-ready version of Photon OS, however, comes for free. It is, in the parlance of Google cloud services, a private image. You can freely download it without registration from Bintray: 
5
+
6
+	https://bintray.com/vmware/photon/gce/view
7
+
8
+The GCE-ready image of Photon OS contains packages and scripts that prepare it for the Google cloud to save you time as you implement a compute cluster or develop cloud applications. The GCE-ready version of Photon OS adds the following packages to the [packages installed with the minimal version](https://github.com/vmware/photon/blob/master/common/data/packages_minimal.json): 
9
+
10
+	sudo, tar, which, google-daemon, google-startup-scripts, 
11
+	kubernetes, perl-DBD-SQLite, perl-DBIx-Simple, perl, ntp
12
+
13
+In addition to a GCE account, the following examples require the gcloud command-line tool; see [https://cloud.google.com/compute/docs/gcloud-compute](https://cloud.google.com/compute/docs/gcloud-compute).
14
+
15
+Here are the commands to create an instance of Photon OS from the Photon GCE image without using cloud-init. In the following commands, you must replace `<bucket-name>` with the name of your bucket. You also need to replace the path to the Photon GCE tar file. 
16
+
17
+	$ gcloud compute instances list
18
+	$ gcloud compute images list
19
+	$ gcloud config list
20
+	$ gsutil mb gs://<bucket-name>
21
+	$ gsutil cp <path-to-photon-gce-image.tar.gz> gs://<bucket-name>/photon-gce.tar.gz
22
+	$ gcloud compute images create photon-gce-image --source-uri gs://<bucket-name>/photon-gce.tar.gz 
23
+	$ gcloud compute instances create photon-gce-vm --machine-type "n1-standard-1" --image photon-gce-image
24
+	$ gcloud compute instances describe photon-gce-vm
25
+	 
26
+
27
+Now, to create a new instance of a Photon OS machine and configure it with a cloud-init user data file, replace the `gcloud compute instances create` command in the example above with the following command. Before running this command, you must upload your user-data file to Google's cloud infrastructure and replace `<path-to-userdata-file>` with its path and file name. 
28
+
29
+	gcloud compute instances create photon-gce-vm --machine-type "n1-standard-1" --image photon-gce-vm --metadata-from-file=user-data=<path-to-userdata-file>
30
+
31
+You can also add a cloud-init user-data file to an existing instance of a Photon OS machine on GCE: 
32
+
33
+	gcloud compute instances add-metadata photon-gce-vm --metadata-from-file=user-data=<path-to-userdata-file>
0 34
\ No newline at end of file
1 35
new file mode 100644
... ...
@@ -0,0 +1,32 @@
0
+# Setting a Static IP Address
1
+
2
+Before you set a static IP address, obtain the name of your Ethernet link by running the following command: 
3
+
4
+	networkctl
5
+	IDX LINK             TYPE               OPERATIONAL SETUP
6
+	  1 lo               loopback           carrier     unmanaged
7
+	  2 eth0             ether              routable    configured
8
+
9
+In the results of the command, you can see the name of an Ethernet link, `eth0`.
10
+
11
+To create a network configuration file that systemd-networkd uses to establish a static IP address for the eth0 network interface, execute the following command as root: 
12
+
13
+	cat > /etc/systemd/network/10-static-en.network << "EOF"
14
+
15
+	[Match]
16
+	Name=eth0
17
+
18
+	[Network]
19
+	Address=198.51.0.2/24
20
+	Gateway=198.51.0.1
21
+	EOF
22
+
23
+Change the new file's mode bits by running the `chmod` command:
24
+
25
+    chmod 644 10-static-en.network
26
+
27
+Apply the configuration by running the following command:
28
+
29
+	systemctl restart systemd-networkd
30
+
31
+For more information, see the man page for systemd-networkd: `man systemd.network`
0 32
\ No newline at end of file
1 33
new file mode 100644
... ...
@@ -0,0 +1,32 @@
0
+# Setting Up Networking for Multiple NICs
1
+
2
+If your machine contains multiple NICs, you should, as a best practice, create a .network configuration file for each network interface. The following scenario demonstrates how to set one wired network interface to use a static IP address and another wired network interface to use a dynamic IP address obtained through DHCP. Keep in mind that the following configurations are examples: You must change the IP addresses and other information to match your network and requirements.  
3
+
4
+First, create the .network file for the static Ethernet connection in /etc/systemd/network. A best practice is to match the exact name of the network interface, which is in this example eth0. This example file also includes a DNS server for the static IP address. As a result, the configuration sets the UseDNS key to false in the DHCP column so that Photon OS ignores the DHCP server for DNS for this interface.  
5
+
6
+	cat > /etc/systemd/network/10-eth0-static-en.network << "EOF"
7
+	[Match]
8
+	Name=eth0
9
+
10
+	[Network]
11
+	Address=10.137.20.11/19
12
+	Gateway=10.137.23.253
13
+	DNS=10.132.71.1
14
+
15
+	[DHCP]
16
+	UseDNS=false
17
+	EOF
18
+
19
+Second, create the .network file for the second network interface, which is named eth1 in this example. This configuration file sets the eth1 interface to an IP address from DHCP and sets DHCP as the source for DNS lookups. Setting the DHCP key to `yes` acquires an IP address for IPv4 and IPv6. To acquire an IP address for IPv4 only, set the DHCP key to <code>ipv4</code>.
20
+
21
+	cat > /etc/systemd/network/50-eth1-dhcp-en.network << "EOF"
22
+
23
+	[Match]
24
+	Name=eth1
25
+
26
+	[Network]
27
+	DHCP=yes  
28
+
29
+	[DHCP]
30
+	UseDNS=true
31
+	EOF
0 32
\ No newline at end of file
1 33
new file mode 100644
... ...
@@ -0,0 +1,58 @@
0
+# Signed Packages
1
+
2
+Photon OS signs its packages and repositories with GPG signatures to bolster security. The GPG signature uses keyed-hash authentication method codes, typically the SHA1 algorithm and an MD5 checksum, to simultaneously verify the integrity and authentication of a package. A keyed-hash message authentication code combines a cryptographic hash function with a secret cryptographic key.
3
+
4
+In Photon OS, GPG signature verification automatically takes place when you install or update a package with the default package manager, tdnf. The default setting in the tdnf configuration file for checking the GPG is set to `1`, for true:  
5
+
6
+    cat /etc/tdnf/tdnf.conf
7
+    [main]
8
+    gpgcheck=1
9
+    installonly_limit=3
10
+    clean_requirements_on_remove=true
11
+    repodir=/etc/yum.repos.d
12
+    cachedir=/var/cache/tdnf
13
+
14
+On Photon OS, you can view the key with which VMware signs packages by running the following command:  
15
+
16
+    rpm -qa gpg-pubkey*
17
+
18
+The command returns the GPG public key:
19
+
20
+    gpg-pubkey-66fd4949-4803fe57
21
+
22
+Once you have the name of the key, you can view information about the key with the `rpm -qi` command, as the following abridged output demonstrates: 
23
+
24
+    rpm -qi gpg-pubkey-66fd4949-4803fe57
25
+    Name        : gpg-pubkey
26
+    Version     : 66fd4949
27
+    Release     : 4803fe57
28
+    Architecture: (none)
29
+    Install Date: Thu Jun 16 11:51:39 2016
30
+    Group       : Public Keys
31
+    Size        : 0
32
+    License     : pubkey
33
+    Signature   : (none)
34
+    Source RPM  : (none)
35
+    Build Date  : Tue Apr 15 01:01:11 2008
36
+    Build Host  : localhost
37
+    Relocations : (not relocatable)
38
+    Packager    : VMware, Inc. -- Linux Packaging Key -- <linux-packages@vmware.com>
39
+    Summary     : gpg(VMware, Inc. -- Linux Packaging Key -- <linux-packages@vmware.                        com>)
40
+    Description :
41
+    -----BEGIN PGP PUBLIC KEY BLOCK-----
42
+    Version: rpm-4.11.2 (NSS-3)
43
+    mI0ESAP+VwEEAMZylR8dOijUPNn3He3GdgM/kOXEhn3uQl+sRMNJUDm1qebi2D5b ...
44
+
45
+If you have one of the RPMs from Photon OS on another Linux system, such as Ubuntu, you can check the status of the SHA and MD5 for the package to verify that it has not been tampered with:
46
+
47
+    rpm -K /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm
48
+    /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm: sha1 md5 OK
49
+
50
+And then you can view the SHA1 digest and the MD5 digest by running the following command: 
51
+
52
+    rpm -Kv /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm
53
+    /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm:
54
+    Header SHA1 digest: OK (89b55443d4c9f67a61ae0c1ec9bf4ece2d6aa32b)
55
+            MD5 digest: OK (51eee659a8730e25fd2a52aff9a6c2c2)
56
+
57
+The above examples show that the Kubernetes package has not been tampered with.
0 58
\ No newline at end of file
1 59
new file mode 100644
... ...
@@ -0,0 +1,47 @@
0
+# Managing Packages in Photon OS with `tdnf`
1
+
2
+## Introduction
3
+
4
+Photon OS manages packages with an open source, yum-compatible package manager called tdnf, for [Tiny Dandified Yum](https://github.com/vmware/tdnf). Tdnf keeps the operating system as small as possible while preserving yum's robust package-management capabilities. 
5
+
6
+On Photon OS, tdnf is the default package manager for installing new packages. It is a C implementation of the DNF package manager without Python dependencies. DNF is the next upcoming major version of yum. 
7
+
8
+Tdnf appears in the minimal and full versions of Photon OS. Tdnf reads yum repositories and works like yum. The full version of Photon OS also includes yum, and you can install packages by using yum if you want. 
9
+
10
+In the minimal version of Photon OS, you can manage packages by using yum, but you must install it first by running the following tdnf command as root: 
11
+
12
+	tdnf install yum
13
+
14
+## How to Configure a Repository
15
+
16
+Photon OS comes with a preconfigured repository called `photon-iso` that resides in `\etc\yum.repos.d.` If you receive an access error message when working with the `photon-iso` repository, it is probably because you do not have the Photon OS ISO mounted. Mount the ISO and the run the following command to update the metadata for all known repositories, including `photon-iso`: 
17
+
18
+	mount /dev/cdrom /media/cdrom
19
+	tdnf makecache
20
+	
21
+	Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
22
+	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
23
+	Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
24
+	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
25
+	Metadata cache created.
26
+
27
+
28
+## Basic `tdnf` Commands
29
+
30
+Here's how to install a package:
31
+
32
+	tdnf install pkgname
33
+
34
+Remove a package: 
35
+
36
+	tdnf erase pkgname
37
+
38
+List enabled repositories:
39
+
40
+	tdnf repolist
41
+
42
+## Other Commands, Options, and Examples
43
+
44
+Tdnf implements a subset of the dnf commands as listed in the [dnf guide](http://dnf.readthedocs.org/en/latest/).
45
+
46
+For a description of the tdnf commands and options, including examples, see the [Photon OS Administration Guide](photon-admin-guide.md).
0 47
\ No newline at end of file
1 48
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+# Tiny DNF for Package Management
1
+
2
+On Photon OS, [Tiny Dandified Yum](https://github.com/vmware/tdnf) or Tiny DNF, is the default package manager for installing new packages. It is a C implementation of the DNF package manager. The standard syntax for `tdnf` commands is the same as that for DNF and is as follows: 
3
+
4
+	tdnf [options] <command> [<arguments>...]
5
+
6
+You can view help information by using the following commands: 
7
+
8
+	tdnf --help
9
+	tdnf -h
0 10
\ No newline at end of file
1 11
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+# Turning Off DHCP
1
+
2
+By default, when Photon OS first starts, it creates a DHCP network configuration file, or rule, which appears in /etc/systemd/network, the highest priority directory for network configuration files with the lowest priority filename:
3
+	cat /etc/systemd/network/99-dhcp-en.network
4
+	[Match]
5
+	Name=e*
6
+
7
+	[Network]
8
+	DHCP=yes
9
+
10
+To turn off DHCP for all Ethernet interfaces, change the value of `DHCP` from `yes` to `no`, save the changes, and then restart the `systemd-networkd` service: 
11
+
12
+	systemctl restart systemd-networkd
13
+
14
+If you create a configuration file with a higher priority filename (e.g. `10-static-en.network`), it is not necessary but still recommended to turn off DHCP.
0 15
new file mode 100644
... ...
@@ -0,0 +1,31 @@
0
+# Turning on Network Debugging
1
+
2
+You can set `systemd-networkd` to work in debug mode so that you can analyze log files with debugging information to help troubleshoot networking problems. The following procedure turns on network debugging by adding a drop-in file in /etc/systemd to customize the default systemd configuration in /usr/lib/systemd. 
3
+
4
+First, run the following command as root to create a directory with this exact name, including the `.d` extension:
5
+
6
+	mkdir -p /etc/systemd/system/systemd-networkd.service.d/
7
+
8
+Second, run the following command as root to establish a systemd drop-in unit with a debugging configuration for the network service:
9
+
10
+	cat > /etc/systemd/system/systemd-networkd.service.d/10-loglevel-debug.conf << "EOF"
11
+	[Service]
12
+	Environment=SYSTEMD_LOG_LEVEL=debug
13
+	EOF
14
+ 
15
+You must reload the systemctl daemon and restart the systemd-networkd service for the changes to take effect: 
16
+
17
+	systemctl daemon-reload
18
+	systemctl restart systemd-networkd
19
+
20
+Verify that your changes took effect:
21
+
22
+	systemd-delta --type=extended
23
+
24
+View the log files by running this command: 
25
+
26
+	journalctl -u systemd-networkd
27
+
28
+When you are finished debugging the network connections, turn debugging off by deleting the drop-in file: 
29
+
30
+	rm /etc/systemd/system/systemd-networkd.service.d/10-loglevel-debug.conf
0 31
\ No newline at end of file
1 32
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+# Use `ip` and `ss` Commands
1
+
2
+Although the `ifconfig` command and the `netstat` command work on Photon OS, VMware recommends that you use the `ip` or `ss` commands. The `ipconfig` and `netstat` commands are deprecated. 
3
+
4
+For example, instead of running `netstat` to display a list of network interfaces, run the `ss` command. Similarly, to display information for IP addresses, instead of running `ifconfig -a`, run the `ip addr` command. Examples:
5
+
6
+	USE THIS IPROUTE COMMAND 	INSTEAD OF THIS NET-TOOL COMMAND
7
+	ip addr 					ifconfig -a
8
+	ss 							netstat
9
+	ip route 					route
10
+	ip maddr 					netstat -g
11
+	ip link set eth0 up 		ifconfig eth0 up
12
+	ip -s neigh					arp -v
13
+	ip link set eth0 mtu 9000	ifconfig eth0 mtu 9000
14
+
15
+Using the `ip route` version of a command instead of the net-tools version often provides more complete, accurate information on Photon OS, as the following example demonstrates: 
16
+
17
+	ip neigh
18
+	198.51.100.2 dev eth0 lladdr 00:50:56:e2:02:0f STALE
19
+	198.51.100.254 dev eth0 lladdr 00:50:56:e7:13:d9 STALE
20
+	198.51.100.1 dev eth0 lladdr 00:50:56:c0:00:08 DELAY
21
+
22
+	arp -a
23
+	? (198.51.100.2) at 00:50:56:e2:02:0f [ether] on eth0
24
+	? (198.51.100.254) at 00:50:56:e7:13:d9 [ether] on eth0
25
+	? (198.51.100.1) at 00:50:56:c0:00:08 [ether] on eth0
0 26
new file mode 100644
... ...
@@ -0,0 +1,55 @@
0
+# Using Predictable Network Interface Names
1
+
2
+On a virtual machine running Photon OS, just as on a bare-metal machine, the Ethernet network interface name might shift from one device to another if you add or removed a card and reboot the machine. A device named `eth2`, for example, might become `eth1` after a NIC is removed and the machine is restarted.
3
+
4
+You can prevent interface names from reordering by turning on [predictable network interface names](https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/). The naming schemes that Photon OS uses can then assign fixed, predictable names to network interfaces even after cards or other firmware are added or removed and the system is restarted. With predictable network interface names enabled, you can select among several options to assign persistent names to network interfaces:
5
+
6
+* Apply the `slot` name policy to set the name of networking devices in the `ens` format with a statically assigned PCI slot number.
7
+* Apply the `mac` name policy to set the name of networking devices in the `enx` format a unique MAC address. 
8
+* Apply the `path` name policy to set the name of networking devices in the `enpXsY` format derived from a device connector's physical location.
9
+
10
+(Although Photon OS also supports the `onboard` name policy to set in the `eno` format the name of networking devices from index numbers given by the firmware, the `onboard` policy might result in nonpersistent names.) 
11
+
12
+The option that you choose depends on your use case and your unique networking requirements. If, for instance, you clone clones virtual machines in a use case that requires the MAC addresses to be different from one another but the interface name to be the same, you should consider using `ens` to keep the slot the same after reboots. 
13
+
14
+Alternatively, if the cloning function supports it and it works for your use case, you can use `enx` to set a MAC address, which also persists after reboots. 
15
+
16
+Here's how to turn on predictable network interface names.
17
+
18
+First, make a backup copy of the following file in case you need to restore it later: 
19
+
20
+    cp /boot/grub/grub.cfg /boot/grub/grub.cfg.original
21
+
22
+Second, to turn on predictable network interface names, edit `/boot/grub/grub.cfg` to remove the following string: 
23
+
24
+    net.ifnames=0
25
+
26
+The string appears near the bottom of the file in the `menuentry` section:
27
+
28
+    menuentry "Photon" {
29
+        linux "/boot/"$photon_linux root=$rootpartition net.ifnames=0 $photon_cmdline
30
+        if [ "$photon_initrd" ]; then
31
+            initrd "/boot/"$photon_initrd
32
+        fi
33
+    }
34
+    # End /boot/grub2/grub.cfg
35
+
36
+Edit out `net.ifnames=0`, but make no other changes to the file, and then save it. 
37
+
38
+Third, specify the types of policies that you want to use for predictable interface names by modifying the `NamePolicy` option in `/lib/systemd/network/99-default.link`. Here's what the file looks like: 
39
+
40
+    cat /lib/systemd/network/99-default.link
41
+    [Link]
42
+    NamePolicy=kernel database
43
+    MACAddressPolicy=persistent
44
+
45
+To use the `ens` or `enx` option, the `slot` policy or the `mac` policy can be added to the space-separated list of policies that follow the `NamePolicy` option in the default link file, `/lib/systemd/network/99-default.link`. The order of the policies matters: Photon OS applies the policy listed first before proceeding to the next policy if the first one fails. Example: 
46
+
47
+    /lib/systemd/network/99-default.link
48
+    [Link]
49
+    NamePolicy=slot mac kernel database
50
+    MACAddressPolicy=persistent
51
+
52
+With the name policy specified in the above example, it's possible that you could still end up with an Ethernet-style interface name if the two previous policies, `slot` and `mac`, fail. 
53
+
54
+For information on setting name policies, see [systemd.link--network device configuration](https://www.freedesktop.org/software/systemd/man/systemd.link.html). 
0 55
\ No newline at end of file
1 56
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+# Using the Network Configuration Manager
1
+
2
+The Network Configuration Manager library that ships with Photon OS 2.0 provides a collection of C, Python, and CLI APIs that simplify common onfiguration tasks for:
3
+- interfaces
4
+- IP addresses (IPv4 and IPv6 addresses)
5
+- routes
6
+- DNS server and domain settings
7
+- DHCP DUID and IAID settings
8
+- NTP server settings
9
+- service management
10
+- object parameters (interfaces and files)
11
+
12
+For additional details, see:
13
+- **CLI** - see the ``-net`` commands in the [Photon Management Daemon Command-line Interface (pmd-cli)](pmd-cli.md)
14
+- **C APIs** - [Network Configuration Manager - C API](netmgr.c.md)
15
+- **Python APIs** - [Network Configuration Manager - Python API](netmgr.python.md)
0 16
\ No newline at end of file
1 17
new file mode 100644
... ...
@@ -0,0 +1,25 @@
0
+# Viewing Services 
1
+
2
+To view a description of all the loaded and active units, run the `systemctl` command without any options or arguments: 
3
+
4
+	systemctl
5
+
6
+To see all the loaded, active, and inactive units and their description, run the following command: 
7
+
8
+	systemctl --all
9
+
10
+To see all the unit files and their current status but no description, run thie following command: 
11
+
12
+	systemctl list-unit-files
13
+
14
+The `grep` command filters the services by a search term, a helpful tactic to recall the exact name of a unit file without looking through a long list of names. Example: 
15
+
16
+	systemctl list-unit-files | grep network
17
+	org.freedesktop.network1.busname           static
18
+	dbus-org.freedesktop.network1.service      enabled
19
+	systemd-networkd-wait-online.service       enabled
20
+	systemd-networkd.service                   enabled
21
+	systemd-networkd.socket                    enabled
22
+	network-online.target                      static
23
+	network-pre.target                         static
24
+	network.target                             static
0 25
\ No newline at end of file
1 26
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+# Working with Repositories and Packages
1
+
2
+The design of Photon OS simplifies life-cycle management and improves the security of packages. Photon OS seeks to reduce the burden and complexity of managing clusters of Linux machines by providing curated package repositories and by securing packages with GPG signatures. 
0 3
\ No newline at end of file
1 4
deleted file mode 100644
... ...
@@ -1,486 +0,0 @@
1
-# Photon Management Daemon Command-line Interface (pmd-cli)
2
-
3
-Photon OS 2.0 provides the Photon Management Daemon command line interface (pmd-cli).
4
-
5
-- [Setup Steps](#setup-steps)
6
-- [Syntax](#syntax)
7
-- [Firewall Management](#firewall-management)
8
-- [Network Management](#network-management)
9
-- [Package Management](#package-management)
10
-- [User Management](#user-management)
11
-
12
-# Setup Steps
13
-
14
-The pmd-cli utility is included with your Photon OS 2.0 distribution. To make sure that you have the latest version, you can run:
15
-~~~~
16
-tdnf install pmd-cli
17
-~~~~
18
-# Syntax
19
-~~~~
20
-pmd-cli [connection_auth_options] <component> <command> [command_options]
21
-~~~~
22
-Passed-in parameter values can be enclosed in single (&#39;) or double-quotes (&quot;) as long as you use matching characters to denote the beginning and end of the value. Unless a parameter value contains special characters or spaces, you can also omit quotes altogether.
23
-
24
-## Connection / Authorization Options
25
-
26
-### Local Connections
27
-
28
-For local connections, you omit the connection and authorization options:
29
-~~~~
30
-pmd-cli <component> <cmd> <options>
31
-~~~~
32
-Permissions for the currently logged-in user apply when executing commands. This is the same as specifying --servername localhost.
33
-
34
-### Remote Connections
35
-
36
-For connecting to a remote server (a server other than the local server), you specify two connection / authorization options:
37
-
38
-- ``--servername``: name of the server
39
-- ``--user``: username of a user account on the server
40
-
41
-**Note:**  For authentication, you can specify the username (–user &lt;username&gt;) on the command line, but never the password. For security reasons, the system must prompt you for the password.
42
-
43
-What follows are three options for remote connections.
44
-
45
-**System User**
46
-~~~~
47
-pmd-cli --servername <server> --user <username>
48
-~~~~
49
-**Lightwave User**
50
-
51
-Before using this method, the pmd server must be joined or should be part of embedded Lightwave.
52
-~~~~
53
-pmd-cli --servername <server> --user <username> --domain <lightwave_domain>
54
-~~~~
55
-**Kerberos spn**
56
-
57
-Before using this method, the client must run kinit successfully.
58
-~~~~
59
-pmd-cli --servername <server> --spn <service_principal_name>
60
-~~~~
61
-## Component
62
-
63
-``<component>`` is one of the following values:
64
-
65
-- ``firewall``
66
-- ``net``
67
-- ``pkg``
68
-- ``usr``
69
-
70
-# Firewall Management
71
-
72
-The Photon Management Daemon provides CLI commands to help you get information about the firewall.
73
-
74
-## Syntax
75
-~~~~
76
-pmd-cli [connection_auth_options] firewall <command> [command_options]
77
-~~~~
78
-## firewall help
79
-
80
-Get help for firewall CLI commands.
81
-~~~~
82
-pmd-cli firewall help
83
-~~~~
84
-## firewall rules
85
-
86
-Get a list of the current persistent firewall rules.
87
-~~~~
88
-pmd-cli firewall rules [command-options]
89
-~~~~
90
-This command returns information about each firewall rule, such as the chain to which it belongs, the policy to enforce, the table to manipulate, and so on.
91
-
92
-Add a new firewall rule.
93
-~~~~
94
-pmd-cli firewall rules --chain <chain_name> --add <rule_specification>
95
-~~~~
96
-Example:
97
-~~~~
98
-pmd-cli firewall rules --chain INPUT --add "-p tcp -m tcp --dport 21 -j ACCEPT"
99
-~~~~
100
-**Note:** To confirm that the firewall rule was added, run iptables -S. Running pmd-cli firewall rules lists only persistent rules.
101
-
102
-Delete a new firewall rule.
103
-~~~~
104
-pmd-cli firewall rules --chain <chain_name> --delete <rule_specification>
105
-~~~~
106
-**Note:**  To confirm that the firewall rule was removed, run iptables -S. Running pmd-cli firewall rules lists only persistent rules.
107
-
108
-Make firewall rule changes peristent (add --persist flag)
109
-~~~~
110
-pmd-cli firewall rules --chain <chain_name> --add <rule_specification> --persist
111
-~~~~
112
-
113
-## firewall version
114
-
115
-Get the version number of the fwmgmt component on the server.
116
-~~~~
117
-pmd-cli firewall version
118
-~~~~
119
-# Network Management
120
-
121
-The Photon Management Daemon provides CLI commands to help you manage network interfaces.
122
-
123
-## Syntax
124
-~~~~
125
-pmd-cli [connection_auth_options] net <command> [command_options]
126
-~~~~
127
-Many of these commands require the interface name (–interface &lt;ifname&gt;). Command options are described below.
128
-
129
-## net link_info
130
-
131
-Get the mac address, mtu, link state, and link mode for the specified interface.
132
-~~~~
133
-pmd-cli net link_info --get --interface <ifname>
134
-~~~~
135
-Set the MAC address, mode (manual or auto), link state (up or down), link mode (manual or auto), and MTU for the specified interface.
136
-~~~~
137
-pmd-cli net link_info --set --interface <ifname> --macaddr <mac_address> --mode <manual|auto> --state <up|down> --mtu <mtu>
138
-~~~~
139
-## net ip4_address
140
-
141
-Get the IPv4 address for the specified interface.
142
-~~~~
143
-pmd-cli net ip4_address --get --interface <ifname>
144
-~~~~
145
-Set the IPv4 address (dot-decimal/prefix notation), mode (dhcp, static, or none), and (optionally) the default gateway for the specified interface.
146
-~~~~
147
-pmd-cli net ip4_address --set --interface <ifname> --mode <dhcp|static|none> --addr <IPv4Address/prefix> --gateway <gateway_address>
148
-~~~~
149
-## net ip6_address
150
-
151
-Get IPv6 address(es) for the specified interface.
152
-~~~~
153
-pmd-cli net ip6_address --get --interface <ifname>
154
-~~~~
155
-Add one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) to the specified interface.
156
-~~~~
157
-pmd-cli net ip6_address --add --interface <ifname> --addrlist <IPv6Addr1/prefix,IPv6Addr2/prefix,...>
158
-~~~~
159
-Delete one or more IPv6 addresses (comma-separated list in colon-separated/prefix notation) from the specified interface.
160
-~~~~
161
-pmd-cli net ip6_address --del --interface <ifname> --addrlist <IPv6Addr1/prefix,IPv6Addr2/prefix,...>
162
-~~~~
163
-Set the DHCP mode (1=enable, 0=disable) and autoconfigure settings (1=enable, 0=disable) for the specified interface.
164
-~~~~
165
-pmd-cli net ip6_address --set --interface <ifname> --dhcp <1|0> --autoconf <1|0>
166
-~~~~
167
-## net ip_route
168
-
169
-Get the static IP route for the specified interface.
170
-~~~~
171
-pmd-cli net ip_route --get --interface <ifname>
172
-~~~~
173
-Add the static IP route (gateway IP, destination network, and metric) to the specified interface.
174
-~~~~
175
-pmd-cli net ip_route --add --interface <ifname> --gateway <GatewayIP> --destination <DestinationNetwork/prefix> --metric <N>
176
-~~~~
177
-Delete the specified static IP route from the specified interface.
178
-~~~~
179
-pmd-cli net ip_route --del --interface <ifname> --destination <DestinationNetwork/prefix>
180
-~~~~
181
-## net dns_servers
182
-
183
-Get the list of DNS servers.
184
-~~~~
185
-pmd-cli net dns_servers --get
186
-~~~~
187
-Set the DNS mode (dhcp or static) for one or more DNS servers (comma-separated list).
188
-~~~~
189
-pmd-cli net dns_servers --set --mode <dhcp|static> --servers <server1,server2,...>
190
-~~~~
191
-Add a DNS server to the list of DNS servers.
192
-~~~~
193
-pmd-cli net dns_servers --add --servers <server>
194
-~~~~
195
-Remove the specified DNS server from the list of DNS servers.
196
-~~~~
197
-pmd-cli net dns_servers --del --servers <server>
198
-~~~~
199
-## net dns_domains
200
-
201
-Get the list of DNS domains.
202
-~~~~
203
-pmd-cli net dns_domains --get
204
-~~~~
205
-Set the list of DNS domains (one or more DNS domains in a comma-separated list).
206
-~~~~
207
-pmd-cli net dns_domains --set --domains <domain1,domain2,...>
208
-~~~~
209
-Add a DNS domain to the list of DNS domains.
210
-~~~~
211
-pmd-cli net dns_domains --add --domains <domain1>
212
-~~~~
213
-Delete a DNS domain from the list of DNS domains.
214
-~~~~
215
-pmd-cli net dns_domains --del --domains <domain1>
216
-~~~~
217
-## net dhcp_duid
218
-
219
-Get the DHCP DUID (optionally interface-specific DUID) for the system.
220
-~~~~
221
-pmd-cli net dhcp_duid --get
222
-~~~~
223
-Set the DHCP DUID for the system, optionally per-interface if the interface is specified.
224
-~~~~
225
-pmd-cli net dhcp_duid --set --duid <duid>
226
-~~~~
227
-## net if_iaid
228
-
229
-Get the IAID for the specified interface.
230
-~~~~
231
-pmd-cli net if_iaid --get --interface <ifname>
232
-~~~~
233
-Set the IAID for the specified interface.
234
-~~~~
235
-pmd-cli net if_iaid --set --interface <ifname> --iaid <iaid>
236
-~~~~
237
-## net ntp_servers
238
-
239
-Get the NTP servers list.
240
-~~~~
241
-pmd-cli net ntp_servers --get
242
-~~~~
243
-Set the NTP servers list.
244
-~~~~
245
-pmd-cli net ntp_servers --set --servers <server1,server2,...>
246
-~~~~
247
-Add the specified server to the NTP servers list.
248
-~~~~
249
-pmd-cli net ntp_servers --add --servers <server>
250
-~~~~
251
-Delete the specified server from the NTP servers list.
252
-~~~~
253
-pmd-cli net ntp_servers --del --servers <server>
254
-~~~~
255
-## net hostname
256
-
257
-Get the system hostname.
258
-~~~~
259
-pmd-cli net hostname --get
260
-~~~~
261
-Set the system hostname.
262
-~~~~
263
-pmd-cli net hostname --set --name <hostname>
264
-~~~~
265
-## net wait_for_link
266
-
267
-Wait for the specified network interface to be up and usable (it can send and receive packets).
268
-~~~~
269
-pmd-cli net wait_for_link --interface <ifname> --timeout <timeout>
270
-~~~~
271
-The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
272
-
273
-**Note:** You might need to use net wait_for_ip to wait until you can send and receive IP packets.
274
-
275
-## net wait_for_ip
276
-
277
-Wait for the specified interface to acquire a valid IP address for the specified address type.
278
-~~~~
279
-pmd-cli net wait_for_ip --interface <ifname> --timeout <timeout> --addrtype <ipv4,ipv6,static_ipv4,static_ipv6,dhcp_ipv4,dhcp_ipv6,auto_ipv6,link_local_ipv6>
280
-~~~~
281
-The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely).
282
-
283
-## net error_info
284
-
285
-Get error information about the specified error code.
286
-~~~~
287
-pmd-cli net error_info --errcode <error_code>
288
-~~~~
289
-Here is a list of error codes:
290
-
291
-- 4097 - invalid parameter
292
-- 4098 - not supported
293
-- 4099 - out of memory
294
-- 4100 - value not found
295
-- 4101 - value exists
296
-- 4102 - invalid interface
297
-- 4103 - invalid mode
298
-- 4104 - bad configuration file
299
-- 4105 - write failed
300
-- 4106 - timout
301
-- 4107 - DCHP timeout
302
-
303
-## net net_info
304
-
305
-Get the specified network configuration parameter for the specified object.
306
-~~~~
307
-pmd-cli net net_info --get --object <ifname or filename> --paramname <param_name>
308
-~~~~
309
-**Note:** The object can be an interface name (for example, &quot;eth0&quot;) or a file name (for example, /etc/systemd/resolved.conf).
310
-
311
-Set the value of the specified network configuration parameter for the specified object (interface or file).
312
-~~~~
313
-pmd-cli net net_info --set --object <ifname or filename> --paramname <param_name> --paramvalue <param_value>
314
-~~~~
315
-**Note** : You can add (+) or remove (-) a parameter by prepending the parameter name with + or -.
316
-
317
-# Package Management
318
-
319
-The Photon Management Daemon provides CLI commands to help you manage packages and repositories.
320
-
321
-## Syntax
322
-~~~~
323
-pmd-cli [connection options] pkg <command> [command options]
324
-~~~~
325
-If a command allows for multiple package names, simply specify on the command line, separated by spaces.
326
-~~~~
327
-pmd-cli pkg info <package_name_1> <package_name_2> <package_name_3> ...
328
-~~~~
329
-## pkg help
330
-
331
-Get help text for pkg CLI commands.
332
-~~~~
333
-pmd-cli pkg help
334
-~~~~
335
-## pkg count
336
-
337
-Get the total number of packages in all repos (including installed).
338
-~~~~
339
-pmd-cli pkg count
340
-~~~~
341
-## pkg distro-sync
342
-
343
-Synchronize installed packages to the latest available versions. If no packages are specified, then all available packages are synchronized.
344
-~~~~
345
-pmd-cli pkg distro-sync
346
-~~~~
347
-## pkg downgrade
348
-
349
-Downgrade the specified package(s). If no packages are specified, then all available packages are downgraded.
350
-~~~~
351
-pmd-cli pkg downgrade <package_name>
352
-~~~~
353
-## pkg erase
354
-
355
-Remove the specified package(s).
356
-~~~~
357
-pmd-cli pkg erase <package_name>
358
-~~~~
359
-## pkg info
360
-
361
-Get general information about the specified package(s),  such as name, version, release, repository, install size, and so on.
362
-~~~~
363
-pmd-cli pkg info <package_name>
364
-~~~~
365
-If no packages are specified, then this command returns information about all packages.
366
-~~~~
367
-## pkg install
368
-~~~~
369
-Install the specified package(s). Update the package if an update is available.
370
-~~~~
371
-pmd-cli pkg install <package_name>
372
-~~~~
373
-## pkg list
374
-
375
-Get a list of packages or groups of packages.
376
-~~~~
377
-pmd-cli pkg list
378
-~~~~
379
-You can filter by group: all, available, installed, extras, obsoletes, recent, and upgrades.
380
-~~~~
381
-pmd-cli pkg list upgrades
382
-~~~~
383
-You can also filter by wildcards.
384
-~~~~
385
-pmd-cli pkg list ph\*
386
-~~~~
387
-## pkg reinstall
388
-
389
-Reinstall the specified package(s).
390
-~~~~
391
-pmd-cli pkg reinstall <package_name>
392
-~~~~
393
-## pkg repolist
394
-
395
-Get a list of the configured software repositories.
396
-~~~~
397
-pmd-cli pkg repolist
398
-~~~~
399
-This command returns a list of the configured software repositories, including the repository ID, repitory name, and status.
400
-
401
-## pkg update
402
-
403
-Update the specified package(s).
404
-~~~~
405
-pmd-cli pkg update <package_name>
406
-~~~~
407
-If no parameters are specified, then all available packages are updated.
408
-
409
-## pkg updateinfo
410
-
411
-Get the update information on all enabled repositories (status = enabled). If this command returns nothing, then the update information may not exist on the server.
412
-~~~~
413
-pmd-cli pkg updateinfo
414
-~~~~
415
-# User Management
416
-
417
-The Photon Management Daemon provides CLI commands to help you manage users and user groups.
418
-
419
-## Syntax
420
-~~~~
421
-pmd-cli [connection options] usr <command> [command options]
422
-~~~~
423
-## usr help
424
-
425
-Display help text for user commands.
426
-~~~~
427
-pmd-cli usr users
428
-~~~~
429
-## usr users
430
-
431
-Get a list of users. This command returns information about each user, including their user name, user ID, user group (if applicable), home directory, and default shell.
432
-~~~~
433
-pmd-cli usr users
434
-~~~~
435
-## usr useradd
436
-
437
-Add a new user. Specify the username.
438
-~~~~
439
-pmd-cli usr useradd <username>
440
-~~~~
441
-The system assigns a user ID, home directory, and default shell to the new user. The user group is unspecified.
442
-
443
-## usr userdel
444
-
445
-Delete the specified user.
446
-~~~~
447
-pmd-cli usr userdel <username>
448
-~~~~
449
-## usr userid
450
-
451
-Get the user ID of the specified user (by name). Used to determine whether the specified user exists.
452
-~~~~
453
-pmd-cli usr userid <username>
454
-~~~~
455
-## usr groups
456
-
457
-Get a list of user groups. This command returns the following information about each user group: user group name and user group ID.
458
-~~~~
459
-pmd-cli usr groups
460
-~~~~
461
-## usr groupadd
462
-
463
-Add a new user group.
464
-~~~~
465
-pmd-cli usr groupadd <user_group_name>
466
-~~~~
467
-The system assigns a group ID to the new user group.
468
-
469
-## usr groupdel
470
-
471
-Delete the specified user group.
472
-~~~~
473
-pmd-cli usr groupdel <user_group_name>
474
-~~~~
475
-## usr groupid
476
-
477
-Get the group ID for the specified user group (by name). Used to determine whether the specified user group exists.
478
-~~~~
479
-pmd-cli usr groupid <user_group_name>
480
-~~~~
481
-## usr version
482
-
483
-Get the version of the usermgmt component at the server.
484
-~~~~
485
-pmd-cli usr version
486
-~~~~
487 1
deleted file mode 100644
... ...
@@ -1,47 +0,0 @@
1
-# Managing Packages in Photon OS with `tdnf`
2
-
3
-## Introduction
4
-
5
-Photon OS manages packages with an open source, yum-compatible package manager called tdnf, for [Tiny Dandified Yum](https://github.com/vmware/tdnf). Tdnf keeps the operating system as small as possible while preserving yum's robust package-management capabilities. 
6
-
7
-On Photon OS, tdnf is the default package manager for installing new packages. It is a C implementation of the DNF package manager without Python dependencies. DNF is the next upcoming major version of yum. 
8
-
9
-Tdnf appears in the minimal and full versions of Photon OS. Tdnf reads yum repositories and works like yum. The full version of Photon OS also includes yum, and you can install packages by using yum if you want. 
10
-
11
-In the minimal version of Photon OS, you can manage packages by using yum, but you must install it first by running the following tdnf command as root: 
12
-
13
-	tdnf install yum
14
-
15
-## How to Configure a Repository
16
-
17
-Photon OS comes with a preconfigured repository called `photon-iso` that resides in `\etc\yum.repos.d.` If you receive an access error message when working with the `photon-iso` repository, it is probably because you do not have the Photon OS ISO mounted. Mount the ISO and the run the following command to update the metadata for all known repositories, including `photon-iso`: 
18
-
19
-	mount /dev/cdrom /media/cdrom
20
-	tdnf makecache
21
-	
22
-	Refreshing metadata for: 'VMware Lightwave 1.0(x86_64)'
23
-	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)Updates'
24
-	Refreshing metadata for: 'VMware Photon Extras 1.0(x86_64)'
25
-	Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)'
26
-	Metadata cache created.
27
-
28
-
29
-## Basic `tdnf` Commands
30
-
31
-Here's how to install a package:
32
-
33
-	tdnf install pkgname
34
-
35
-Remove a package: 
36
-
37
-	tdnf erase pkgname
38
-
39
-List enabled repositories:
40
-
41
-	tdnf repolist
42
-
43
-## Other Commands, Options, and Examples
44
-
45
-Tdnf implements a subset of the dnf commands as listed in the [dnf guide](http://dnf.readthedocs.org/en/latest/).
46
-
47
-For a description of the tdnf commands and options, including examples, see the [Photon OS Administration Guide](photon-admin-guide.md).
48 1
\ No newline at end of file
49 2
new file mode 100644
... ...
@@ -0,0 +1,56 @@
0
+# Using the Photon Management Daemon
1
+
2
+The Photon Management Daemon (PMD) that ships with Photon OS 2.0 provides the remote management of a Photon instance via several APIs: a command line client (pmd-cli), a REST API, and a Python API. The PMD provides the ability to manage network interfaces, packages, firewalls, users, and user groups.
3
+
4
+## Installing the pmd Package
5
+
6
+The pmd package is included with your Photon OS 2.0 distribution. To make sure that you have the latest version, you can run:
7
+~~~~
8
+# tdnf install pmd
9
+# systemctl start pmd
10
+~~~~
11
+## Available APIs
12
+
13
+### pmd-cli
14
+
15
+The pmd-cli utility enables Photon customers to invoke API requests securely on local and remote servers. For details, see [Photon Management Daemon Command-line Interface (pmd-cli)](pmd-cli.md).
16
+
17
+### PMD REST API
18
+
19
+The PMD REST API is an openapi 2.0 specification. Once the pmd package is installed, you can use a Swagger UI tool to browse the REST API specifications (/etc/pmd/restapispec.json).
20
+You can also browse it using the copenapi_cli tool that comes with the pmd package:
21
+~~~~
22
+# copenapi_cli --apispec /etc/pmd/restapispec.json
23
+~~~~
24
+For more information about the copenapi_cli tool, refer to [github.com/vmware/copenapi](https://github.com/vmware/copenapi).
25
+
26
+### PMD Python API
27
+
28
+Python3 is included with your Photon OS 2.0 distribution. PMD Python interfaces are available for python3 (pmd-python3) and python2 (pmd-python2). You can use tdnf to ensure that the latest version is installed:
29
+~~~~
30
+# tdnf install pmd-python3
31
+# systemctl start pmd
32
+~~~~
33
+To navigate the help documentation for the pmd Python packages:
34
+~~~~
35
+# python3
36
+>>> import pmd
37
+>>> net = pmd.server().net
38
+>>> help(pmd)
39
+~~~~
40
+To show help text for individual interfaces:
41
+~~~~
42
+>>> help(pmd.server().net)
43
+>>> help(pmd.server().pkg)
44
+>>> help(pmd.server().firewall)
45
+>>> help(pmd.server().user)
46
+~~~~
47
+For details about the network commands, see also the [Network Configuration Manager - Python API](netmgr.python.md).
48
+
49
+### PMD C Documentation
50
+
51
+PMD C APIs are defined in the header files (pmd_fwmgmt.h, pmd_netmgr.h, pmd_pkgmgmt.h, pmd_usermgmt.h) that are stored in the following location:  
52
+~~~~
53
+[https://github.com/vmware/pmd/tree/master/include](https://github.com/vmware/pmd/tree/master/include)
54
+~~~~
55
+For details about the network commands, see also the [Network Configuration Manager - C API](netmgr.c.md).