Change-Id: Ib92d355d8167258b40d2ea9b3128c07a312a15ba
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1256
Reviewed-by: Steve Hoenisch <shoenisch@vmware.com>
Tested-by: Steve Hoenisch <shoenisch@vmware.com>
| ... | ... |
@@ -1,11 +1,9 @@ |
| 1 |
-# Photon OS Administration Guide |
|
| 2 |
- |
|
| 3 | 1 |
- [Introduction](#introduction) |
| 4 | 2 |
- [Examining the Packages in the SPECS Directory on |
| 5 | 3 |
Github](#examining-the-packages-in-the-specs-directory-on-github) |
| 6 | 4 |
- [Looking at the Differences Between the Minimal and the Full |
| 7 | 5 |
Version](#looking-at-the-differences-between-the-minimal-and-the-full-version) |
| 8 |
- - [The Root Account and the sudo and su |
|
| 6 |
+ - [The Root Account and the `sudo` and `su` |
|
| 9 | 7 |
Commands](#the-root-account-and-the-sudo-and-su-commands) |
| 10 | 8 |
- [Quick Start](#quick-start) |
| 11 | 9 |
- [Obtaining the ISO from Bintray and Creating a Photon OS VM in |
| ... | ... |
@@ -30,6 +28,9 @@ |
| 30 | 30 |
- [Options for Commands](#options-for-commands) |
| 31 | 31 |
- [Commands](#commands) |
| 32 | 32 |
- [Adding a New Repository](#adding-a-new-repository) |
| 33 |
+ - [Adding the Dev Repository to Get New Packages from the GitHub |
|
| 34 |
+ Dev |
|
| 35 |
+ Branch](#adding-the-dev-repository-to-get-new-packages-from-the-github-dev-branch) |
|
| 33 | 36 |
- [Managing Services with systemd](#managing-services-with-systemd) |
| 34 | 37 |
- [Viewing Services](#viewing-services) |
| 35 | 38 |
- [Controlling Services](#controlling-services) |
| ... | ... |
@@ -54,6 +55,8 @@ |
| 54 | 54 |
NICs](#setting-up-networking-for-multiple-nics) |
| 55 | 55 |
- [Combining DHCP and Static IP Addresses with IPv4 and |
| 56 | 56 |
IPv6](#combining-dhcp-and-static-ip-addresses-with-ipv4-and-ipv6) |
| 57 |
+ - [Using Predictable Network Interface |
|
| 58 |
+ Names](#using-predictable-network-interface-names) |
|
| 57 | 59 |
- [Inspecting the Status of Network Links with |
| 58 | 60 |
`networkctl`](#inspecting-the-status-of-network-links-with-networkctl) |
| 59 | 61 |
- [Turning on Network Debugging](#turning-on-network-debugging) |
| ... | ... |
@@ -71,20 +74,31 @@ |
| 71 | 71 |
- [Docker Containers](#docker-containers) |
| 72 | 72 |
- [Kubernetes](#kubernetes) |
| 73 | 73 |
- [RPM-OSTree](#rpm-ostree) |
| 74 |
+- [Installing Sendmail](#installing-sendmail) |
|
| 75 |
+ - [Fixing Sendmail If Installed Before an FQDN Was |
|
| 76 |
+ Set](#fixing-sendmail-if-installed-before-an-fqdn-was-set) |
|
| 77 |
+- [Changing the Locale](#changing-the-locale) |
|
| 74 | 78 |
- [Disabling TLS 1.0 to Improve Transport Layer |
| 75 |
- Security](#disabling-tls-1.0-to-improve-transport-layer-security) |
|
| 76 |
-- [Building a Package from a Source |
|
| 77 |
- RPM](#building-a-package-from-a-source-rpm) |
|
| 79 |
+ Security](#disabling-tls-10-to-improve-transport-layer-security) |
|
| 80 |
+- [Working with Repositories and |
|
| 81 |
+ Packages](#working-with-repositories-and-packages) |
|
| 82 |
+ - [Photon OS Package |
|
| 83 |
+ Repositories](#photon-os-package-repositories) |
|
| 84 |
+ - [Examining Signed Packages](#examining-signed-packages) |
|
| 85 |
+ - [Building a Package from a Source |
|
| 86 |
+ RPM](#building-a-package-from-a-source-rpm) |
|
| 87 |
+ - [Compiling C++ Code on the Minimal Version of Photon |
|
| 88 |
+ OS](#compiling-c-code-on-the-minimal-version-of-photon-os) |
|
| 78 | 89 |
- [References](#references) |
| 79 | 90 |
|
| 80 | 91 |
|
| 81 | 92 |
## Introduction |
| 82 | 93 |
|
| 83 |
-This guide describes the fundamentals of administering Photon OS, the free, open-source minimalist Linux operating system from VMware that is optimized for cloud computing platforms, VMware vSphere deployments, and applications native to the cloud. |
|
| 94 |
+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. |
|
| 84 | 95 |
|
| 85 | 96 |
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. |
| 86 | 97 |
|
| 87 |
-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 and optionally works with RPM-OSTree for image-based system versioning. |
|
| 98 |
+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. Photon OS optionally works with RPM-OSTree for image-based system versioning. |
|
| 88 | 99 |
|
| 89 | 100 |
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. |
| 90 | 101 |
|
| ... | ... |
@@ -357,7 +371,7 @@ The build number in the results maps to the commit number on the VMware Photon O |
| 357 | 357 |
|
| 358 | 358 |
## Tiny DNF for Package Management |
| 359 | 359 |
|
| 360 |
-On Photon OS, Tiny DNF is the default package manager for installing new packages. Tdnf is a C implementation of DNF package manager. The standard syntax for tdnf commands is the same as that for DNF: |
|
| 360 |
+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: |
|
| 361 | 361 |
|
| 362 | 362 |
tdnf [options] <command> [<arguments>...] |
| 363 | 363 |
|
| ... | ... |
@@ -434,7 +448,7 @@ The command purges the repository data from the cache: |
| 434 | 434 |
|
| 435 | 435 |
### Options for Commands |
| 436 | 436 |
|
| 437 |
-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. |
|
| 437 |
+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. |
|
| 438 | 438 |
|
| 439 | 439 |
OPTION DESCRIPTION |
| 440 | 440 |
--allowerasing Allow erasing of installed packages to resolve dependencies |
| ... | ... |
@@ -644,7 +658,7 @@ You can also run the `upgrade` command with the `refresh` option to update the c |
| 644 | 644 |
|
| 645 | 645 |
tdnf upgrade-to ruby2.3 |
| 646 | 646 |
|
| 647 |
-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). |
|
| 647 |
+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). |
|
| 648 | 648 |
|
| 649 | 649 |
### Adding a New Repository |
| 650 | 650 |
|
| ... | ... |
@@ -708,6 +722,26 @@ After establishing a new repository, you must run the following command to updat |
| 708 | 708 |
Refreshing metadata for: 'VMware Photon Linux 1.0(x86_64)' |
| 709 | 709 |
Metadata cache created. |
| 710 | 710 |
|
| 711 |
+### Adding the Dev Repository to Get New Packages from the GitHub Dev Branch |
|
| 712 |
+ |
|
| 713 |
+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: |
|
| 714 |
+ |
|
| 715 |
+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: |
|
| 716 |
+ |
|
| 717 |
+ cat > /etc/yum.repos.d/photon-dev.repo << "EOF" |
|
| 718 |
+ [photon-dev] |
|
| 719 |
+ name=VMware Photon Linux Dev(x86_64) |
|
| 720 |
+ baseurl=https://dl.bintray.com/vmware/photon_dev_$basearch |
|
| 721 |
+ gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY |
|
| 722 |
+ gpgcheck=1 |
|
| 723 |
+ enabled=1 |
|
| 724 |
+ skip_if_unavailable=True |
|
| 725 |
+ EOF |
|
| 726 |
+ |
|
| 727 |
+After establishing a new repository, you must run the following command to update the cached binary metadata for the repositories that tdnf polls: |
|
| 728 |
+ |
|
| 729 |
+ tdnf makecache |
|
| 730 |
+ |
|
| 711 | 731 |
## Managing Services with systemd |
| 712 | 732 |
|
| 713 | 733 |
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. |
| ... | ... |
@@ -838,7 +872,7 @@ This command reveals the messages for only the systemd service unit specified by |
| 838 | 838 |
|
| 839 | 839 |
journalctl -u auditd |
| 840 | 840 |
|
| 841 |
-For more information, see the journalctl man page: `man journalctl` |
|
| 841 |
+For more information, see the journalctl man page by running this command on Photon OS: `man journalctl` |
|
| 842 | 842 |
|
| 843 | 843 |
### Migrating Scripts to systemd |
| 844 | 844 |
|
| ... | ... |
@@ -922,7 +956,13 @@ As you can see, the /usr/lib/systemd/network directory contains several network |
| 922 | 922 |
|
| 923 | 923 |
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. |
| 924 | 924 |
|
| 925 |
-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. For Photon OS to apply the new configuration, you must restart the `systemd-networkd` service by running the following command: |
|
| 925 |
+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. |
|
| 926 |
+ |
|
| 927 |
+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: |
|
| 928 |
+ |
|
| 929 |
+ chmod 644 10-static-en.network |
|
| 930 |
+ |
|
| 931 |
+For Photon OS to apply the new configuration, you must restart the `systemd-networkd` service by running the following command: |
|
| 926 | 932 |
|
| 927 | 933 |
systemctl restart systemd-networkd |
| 928 | 934 |
|
| ... | ... |
@@ -953,6 +993,10 @@ To create a network configuration file that systemd-networkd uses to establish a |
| 953 | 953 |
Gateway=192.168.0.1 |
| 954 | 954 |
EOF |
| 955 | 955 |
|
| 956 |
+Change the new file's mode bits by running the `chmod` command: |
|
| 957 |
+ |
|
| 958 |
+ chmod 644 10-static-en.network |
|
| 959 |
+ |
|
| 956 | 960 |
Apply the configuration by running the following command: |
| 957 | 961 |
|
| 958 | 962 |
systemctl restart systemd-networkd |
| ... | ... |
@@ -1086,6 +1130,62 @@ Here's how to use static IP addresses for both IPv4 and IPv6: |
| 1086 | 1086 |
Address=fd00::1/48 |
| 1087 | 1087 |
Gateway=fd00::252 |
| 1088 | 1088 |
|
| 1089 |
+### Using Predictable Network Interface Names |
|
| 1090 |
+ |
|
| 1091 |
+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. |
|
| 1092 |
+ |
|
| 1093 |
+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: |
|
| 1094 |
+ |
|
| 1095 |
+* Apply the `slot` name policy to set the name of networking devices in the `ens` format with a statically assigned PCI slot number. |
|
| 1096 |
+* Apply the `mac` name policy to set the name of networking devices in the `enx` format a unique MAC address. |
|
| 1097 |
+* Apply the `path` name policy to set the name of networking devices in the `enpXsY` format derived from a device connector's physical location. |
|
| 1098 |
+ |
|
| 1099 |
+(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.) |
|
| 1100 |
+ |
|
| 1101 |
+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. |
|
| 1102 |
+ |
|
| 1103 |
+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. |
|
| 1104 |
+ |
|
| 1105 |
+Here's how to turn on predictable network interface names. |
|
| 1106 |
+ |
|
| 1107 |
+First, make a backup copy of the following file in case you need to restore it later: |
|
| 1108 |
+ |
|
| 1109 |
+ cp /boot/grub/grub.cfg /boot/grub/grub.cfg.original |
|
| 1110 |
+ |
|
| 1111 |
+Second, to turn on predictable network interface names, edit `/boot/grub/grub.cfg` to remove the following string: |
|
| 1112 |
+ |
|
| 1113 |
+ net.ifnames=0 |
|
| 1114 |
+ |
|
| 1115 |
+The string appears near the bottom of the file in the `menuentry` section: |
|
| 1116 |
+ |
|
| 1117 |
+ menuentry "Photon" {
|
|
| 1118 |
+ linux "/boot/"$photon_linux root=$rootpartition net.ifnames=0 $photon_cmdline |
|
| 1119 |
+ if [ "$photon_initrd" ]; then |
|
| 1120 |
+ initrd "/boot/"$photon_initrd |
|
| 1121 |
+ fi |
|
| 1122 |
+ } |
|
| 1123 |
+ # End /boot/grub2/grub.cfg |
|
| 1124 |
+ |
|
| 1125 |
+Edit out `net.ifnames=0`, but make no other changes to the file, and then save it. |
|
| 1126 |
+ |
|
| 1127 |
+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: |
|
| 1128 |
+ |
|
| 1129 |
+ cat /lib/systemd/network/99-default.link |
|
| 1130 |
+ [Link] |
|
| 1131 |
+ NamePolicy=kernel database |
|
| 1132 |
+ MACAddressPolicy=persistent |
|
| 1133 |
+ |
|
| 1134 |
+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: |
|
| 1135 |
+ |
|
| 1136 |
+ /lib/systemd/network/99-default.link |
|
| 1137 |
+ [Link] |
|
| 1138 |
+ NamePolicy=slot mac kernel database |
|
| 1139 |
+ MACAddressPolicy=persistent |
|
| 1140 |
+ |
|
| 1141 |
+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. |
|
| 1142 |
+ |
|
| 1143 |
+For information on setting name policies, see [systemd.link--network device configuration](https://www.freedesktop.org/software/systemd/man/systemd.link.html). |
|
| 1144 |
+ |
|
| 1089 | 1145 |
### Inspecting the Status of Network Links with `networkctl` |
| 1090 | 1146 |
|
| 1091 | 1147 |
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. |
| ... | ... |
@@ -1283,7 +1383,9 @@ The cloud-init service is commonly used on EC2 to configure the cloud instance o |
| 1283 | 1283 |
|
| 1284 | 1284 |
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. |
| 1285 | 1285 |
|
| 1286 |
-The following code assumes you have installed and set up the Amazon AWS CLI and the EC2 CLI 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). |
|
| 1286 |
+The following code assumes you have installed and set up the Amazon AWS CLI and the EC2 CLI 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). |
|
| 1287 |
+ |
|
| 1288 |
+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: |
|
| 1287 | 1289 |
|
| 1288 | 1290 |
$ mkdir bundled |
| 1289 | 1291 |
$ tar -zxvf ./photon-ami.tar.gz |
| ... | ... |
@@ -1337,7 +1439,7 @@ Now check the cloud-init output log file on EC2 at `/var/log/cloud-init-output.l |
| 1337 | 1337 |
|
| 1338 | 1338 |
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). |
| 1339 | 1339 |
|
| 1340 |
-With Photon OS, you can also build cloud images on Google Compute Engine and other cloud providers; for more information, see [Compatible Cloud Images](https://github.com/vmware/photon/blob/master/docs/cloud-images.md). |
|
| 1340 |
+With Photon OS, you can also build cloud images on Google Compute Engine and other cloud providers; see [Compatible Cloud Images](https://github.com/vmware/photon/blob/master/docs/cloud-images.md). |
|
| 1341 | 1341 |
|
| 1342 | 1342 |
### Running a Photon OS Machine on GCE |
| 1343 | 1343 |
|
| ... | ... |
@@ -1414,6 +1516,101 @@ The OSTree Server installation option creates an instance of a server that manag |
| 1414 | 1414 |
|
| 1415 | 1415 |
For more information, see the extensive sections on RPM-OSTree in the [Photon OS wiki](https://github.com/vmware/photon/wiki). |
| 1416 | 1416 |
|
| 1417 |
+## Installing Sendmail |
|
| 1418 |
+ |
|
| 1419 |
+Before you install Sendmail, you should set the fully qualified domain name (FQDN) of your Photon OS machine. |
|
| 1420 |
+ |
|
| 1421 |
+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. |
|
| 1422 |
+ |
|
| 1423 |
+Sendmail resides in the Photon extras repository. You can install it with `tdnf` after setting the machine's FQDN. Here's how: |
|
| 1424 |
+ |
|
| 1425 |
+First, check whether the machine's FQDN is set by running the `hostnamectl status` command: |
|
| 1426 |
+ |
|
| 1427 |
+ hostnamectl status |
|
| 1428 |
+ Static hostname: photon-d9ee400e194e |
|
| 1429 |
+ Icon name: computer-vm |
|
| 1430 |
+ Chassis: vm |
|
| 1431 |
+ Machine ID: a53b414142f944319bd0c8df6d811f36 |
|
| 1432 |
+ Boot ID: 1f75baca8cc249f79c3794978bd82977 |
|
| 1433 |
+ Virtualization: vmware |
|
| 1434 |
+ Operating System: VMware Photon/Linux |
|
| 1435 |
+ Kernel: Linux 4.4.8 |
|
| 1436 |
+ Architecture: x86-64 |
|
| 1437 |
+ |
|
| 1438 |
+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. |
|
| 1439 |
+ |
|
| 1440 |
+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: |
|
| 1441 |
+ |
|
| 1442 |
+ hostnamectl set-hostname photon-d9ee400e194e.corp.example.com |
|
| 1443 |
+ |
|
| 1444 |
+The `hostnamectl status` command now shows that the machine has an FQDN: |
|
| 1445 |
+ |
|
| 1446 |
+ root@photon-d9ee400e194e [ ~ ]# hostnamectl status |
|
| 1447 |
+ Static hostname: photon-d9ee400e194e.corp.example.com |
|
| 1448 |
+ Icon name: computer-vm |
|
| 1449 |
+ Chassis: vm |
|
| 1450 |
+ Machine ID: a53b414142f944319bd0c8df6d811f36 |
|
| 1451 |
+ Boot ID: 1f75baca8cc249f79c3794978bd82977 |
|
| 1452 |
+ Virtualization: vmware |
|
| 1453 |
+ Operating System: VMware Photon/Linux |
|
| 1454 |
+ Kernel: Linux 4.4.8 |
|
| 1455 |
+ Architecture: x86-64 |
|
| 1456 |
+ |
|
| 1457 |
+Next, install Sendmail: |
|
| 1458 |
+ |
|
| 1459 |
+ tdnf install sendmail |
|
| 1460 |
+ |
|
| 1461 |
+Make sure it is enabled: |
|
| 1462 |
+ |
|
| 1463 |
+ systemctl status sendmail |
|
| 1464 |
+ |
|
| 1465 |
+Enable Sendmail if it's disabled and then start it: |
|
| 1466 |
+ |
|
| 1467 |
+ systemctl enable sendmail |
|
| 1468 |
+ systemctl start sendmail |
|
| 1469 |
+ |
|
| 1470 |
+### Fixing Sendmail If Installed Before an FQDN Was Set |
|
| 1471 |
+ |
|
| 1472 |
+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. |
|
| 1473 |
+ |
|
| 1474 |
+First, set an FQDN for your Photon OS machine. |
|
| 1475 |
+ |
|
| 1476 |
+Then, run the following commands in the order below: |
|
| 1477 |
+ |
|
| 1478 |
+ echo $(hostname -f) > /etc/mail/local-host-names |
|
| 1479 |
+ |
|
| 1480 |
+ cat > /etc/mail/aliases << "EOF" |
|
| 1481 |
+ postmaster: root |
|
| 1482 |
+ MAILER-DAEMON: root |
|
| 1483 |
+ EOF |
|
| 1484 |
+ |
|
| 1485 |
+ /bin/newaliases |
|
| 1486 |
+ |
|
| 1487 |
+ cd /etc/mail |
|
| 1488 |
+ |
|
| 1489 |
+ m4 m4/cf.m4 sendmail.mc > sendmail.cf |
|
| 1490 |
+ |
|
| 1491 |
+ chmod 700 /var/spool/clientmqueue |
|
| 1492 |
+ |
|
| 1493 |
+ chown smmsp:smmsp /var/spool/clientmqueue |
|
| 1494 |
+ |
|
| 1495 |
+## Changing the Locale |
|
| 1496 |
+ |
|
| 1497 |
+You can change the locale if the default locale, shown below by running the `localectl` command, fails to fulfill your requirements: |
|
| 1498 |
+ |
|
| 1499 |
+ localectl |
|
| 1500 |
+ System Locale: LANG=en_US.UTF-8 |
|
| 1501 |
+ VC Keymap: n/a |
|
| 1502 |
+ X11 Layout: n/a |
|
| 1503 |
+ |
|
| 1504 |
+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: |
|
| 1505 |
+ |
|
| 1506 |
+ locale-gen.sh |
|
| 1507 |
+ |
|
| 1508 |
+Finally, run the following command to set the new locale, replacing the example (`en_US.UTF-8`) with the locale that you want: |
|
| 1509 |
+ |
|
| 1510 |
+ localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" |
|
| 1511 |
+ |
|
| 1417 | 1512 |
## Disabling TLS 1.0 to Improve Transport Layer Security |
| 1418 | 1513 |
|
| 1419 | 1514 |
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. |
| ... | ... |
@@ -1458,7 +1655,91 @@ For information about the vulnerability in SSL 3.0, see [SSL 3.0 Protocol Vulner |
| 1458 | 1458 |
|
| 1459 | 1459 |
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). |
| 1460 | 1460 |
|
| 1461 |
-## Building a Package from a Source RPM |
|
| 1461 |
+## Working with Repositories and Packages |
|
| 1462 |
+ |
|
| 1463 |
+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. |
|
| 1464 |
+ |
|
| 1465 |
+### Photon OS Package Repositories |
|
| 1466 |
+ |
|
| 1467 |
+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: |
|
| 1468 |
+ |
|
| 1469 |
+ ls /etc/yum.repos.d/ |
|
| 1470 |
+ lightwave.repo |
|
| 1471 |
+ photon-extras.repo |
|
| 1472 |
+ photon-iso.repo |
|
| 1473 |
+ photon-updates.repo |
|
| 1474 |
+ photon.repo |
|
| 1475 |
+ |
|
| 1476 |
+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. |
|
| 1477 |
+ |
|
| 1478 |
+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. |
|
| 1479 |
+ |
|
| 1480 |
+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. |
|
| 1481 |
+ |
|
| 1482 |
+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. |
|
| 1483 |
+ |
|
| 1484 |
+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. |
|
| 1485 |
+ |
|
| 1486 |
+### Examining Signed Packages |
|
| 1487 |
+ |
|
| 1488 |
+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. |
|
| 1489 |
+ |
|
| 1490 |
+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: |
|
| 1491 |
+ |
|
| 1492 |
+ cat /etc/tdnf/tdnf.conf |
|
| 1493 |
+ [main] |
|
| 1494 |
+ gpgcheck=1 |
|
| 1495 |
+ installonly_limit=3 |
|
| 1496 |
+ clean_requirements_on_remove=true |
|
| 1497 |
+ repodir=/etc/yum.repos.d |
|
| 1498 |
+ cachedir=/var/cache/tdnf |
|
| 1499 |
+ |
|
| 1500 |
+On Photon OS, you can view the key with which VMware signs packages by running the following command: |
|
| 1501 |
+ |
|
| 1502 |
+ rpm -qa gpg-pubkey* |
|
| 1503 |
+ |
|
| 1504 |
+The command returns the GPG public key: |
|
| 1505 |
+ |
|
| 1506 |
+ gpg-pubkey-66fd4949-4803fe57 |
|
| 1507 |
+ |
|
| 1508 |
+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: |
|
| 1509 |
+ |
|
| 1510 |
+ rpm -qi gpg-pubkey-66fd4949-4803fe57 |
|
| 1511 |
+ Name : gpg-pubkey |
|
| 1512 |
+ Version : 66fd4949 |
|
| 1513 |
+ Release : 4803fe57 |
|
| 1514 |
+ Architecture: (none) |
|
| 1515 |
+ Install Date: Thu Jun 16 11:51:39 2016 |
|
| 1516 |
+ Group : Public Keys |
|
| 1517 |
+ Size : 0 |
|
| 1518 |
+ License : pubkey |
|
| 1519 |
+ Signature : (none) |
|
| 1520 |
+ Source RPM : (none) |
|
| 1521 |
+ Build Date : Tue Apr 15 01:01:11 2008 |
|
| 1522 |
+ Build Host : localhost |
|
| 1523 |
+ Relocations : (not relocatable) |
|
| 1524 |
+ Packager : VMware, Inc. -- Linux Packaging Key -- <linux-packages@vmware.com> |
|
| 1525 |
+ Summary : gpg(VMware, Inc. -- Linux Packaging Key -- <linux-packages@vmware. com>) |
|
| 1526 |
+ Description : |
|
| 1527 |
+ -----BEGIN PGP PUBLIC KEY BLOCK----- |
|
| 1528 |
+ Version: rpm-4.11.2 (NSS-3) |
|
| 1529 |
+ mI0ESAP+VwEEAMZylR8dOijUPNn3He3GdgM/kOXEhn3uQl+sRMNJUDm1qebi2D5b ... |
|
| 1530 |
+ |
|
| 1531 |
+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: |
|
| 1532 |
+ |
|
| 1533 |
+ rpm -K /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm |
|
| 1534 |
+ /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm: sha1 md5 OK |
|
| 1535 |
+ |
|
| 1536 |
+And then you can view the SHA1 digest and the MD5 digest by running the following command: |
|
| 1537 |
+ |
|
| 1538 |
+ rpm -Kv /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm |
|
| 1539 |
+ /home/steve/workspace/photon/stage/SRPMS/kubernetes-1.1.8-4.ph1.src.rpm: |
|
| 1540 |
+ Header SHA1 digest: OK (89b55443d4c9f67a61ae0c1ec9bf4ece2d6aa32b) |
|
| 1541 |
+ MD5 digest: OK (51eee659a8730e25fd2a52aff9a6c2c2) |
|
| 1542 |
+ |
|
| 1543 |
+The above examples show that the Kubernetes package has not been tampered with. |
|
| 1544 |
+ |
|
| 1545 |
+### Building a Package from a Source RPM |
|
| 1462 | 1546 |
|
| 1463 | 1547 |
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: |
| 1464 | 1548 |
|
| ... | ... |
@@ -1523,6 +1804,35 @@ To install the RPM, run the following command with your unprivileged user accoun |
| 1523 | 1523 |
|
| 1524 | 1524 |
rpm -i RPMS/x86_64/sed-4.2.2-2.x86_64.rpm |
| 1525 | 1525 |
|
| 1526 |
+### Compiling C++ Code on the Minimal Version of Photon OS |
|
| 1527 |
+ |
|
| 1528 |
+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: |
|
| 1529 |
+ |
|
| 1530 |
+ #include <stdio.h> |
|
| 1531 |
+ int main() |
|
| 1532 |
+ {
|
|
| 1533 |
+ return 0; |
|
| 1534 |
+ } |
|
| 1535 |
+ |
|
| 1536 |
+The errors look something like this: |
|
| 1537 |
+ |
|
| 1538 |
+ gcc test.c |
|
| 1539 |
+ -bash: gcc: command not found |
|
| 1540 |
+ tdnf install gcc -y |
|
| 1541 |
+ gcc test.c |
|
| 1542 |
+ test.c:1:19: fatal error: stdio.h: No such file or directory |
|
| 1543 |
+ compilation terminated. |
|
| 1544 |
+ |
|
| 1545 |
+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: |
|
| 1546 |
+ |
|
| 1547 |
+* gcc |
|
| 1548 |
+* glibc-devel |
|
| 1549 |
+* binutils |
|
| 1550 |
+ |
|
| 1551 |
+Here's the `tdnf` command to install these packages: |
|
| 1552 |
+ |
|
| 1553 |
+ tdnf install gcc glibc-devel binutils |
|
| 1554 |
+ |
|
| 1526 | 1555 |
## References |
| 1527 | 1556 |
|
| 1528 | 1557 |
The following technical articles and guides appear in the [Photon OS wiki](https://github.com/vmware/photon/wiki): |
| ... | ... |
@@ -1540,3 +1850,5 @@ The following technical articles and guides appear in the [Photon OS wiki](https |
| 1540 | 1540 |
|
| 1541 | 1541 |
|
| 1542 | 1542 |
|
| 1543 |
+ |
|
| 1544 |
+ |