This post is a quick collection of commands used to configure VMwares recently released Photon OS, and to get started with Docker.
Photon is a technology preview of a minimal Linux container host. It is designed to have a small footprint and boot extremely quickly on VMware platforms. Photon is intended to invite collaboration around running containerized applications in a virtualized environment.
To get started with Photon, check this post.
Enable SSH access for root
#Change "PermitRootLogin no" to "PermitRootLogin yes" nano /etc/ssh/sshd_config systemctl restart sshd #Or sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config systemctl restart sshd
Configure Network
The network configuration is stored in /etc/systemd/network/10-dhcp-eth0.network. To configure a static IP address, disable DHCP configure static addresses:
root [ ~ ]# mv /etc/systemd/network/10-dhcp-eth0.network /etc/systemd/network/10-static-eth0.network root [ ~ ]# nano /etc/systemd/network/10-static-eth0.network root [ ~ ]# cat /etc/systemd/network/10-static-eth0.network [Match] Name=eth0 [Network] Address=192.168.79.134/24 Gateway=192.168.79.2 DNS=8.8.8.8 Domains=photon.local #Restart network root [ ~ ]# systemctl restart systemd-networkd.service #Display IP address information root [ ~ ]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:BA:E5:39 inet addr:192.168.79.134 Bcast:192.168.79.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:114 errors:0 dropped:0 overruns:0 frame:0 TX packets:98 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:12757 TX bytes:16234 #Display routing table root [ ~ ]# ip route default via 192.168.79.2 dev eth0 proto static 192.168.79.0/24 dev eth0 proto kernel scope link src 192.168.79.134
Manage Services
#Start service systemctl start sshd #Stop service systemctl stop sshd #Restart service systemctl restart sshd #Configure a service to be automatically started at boot time systemctl enable sshd
Logfiles
Logfiles in Photon are managed by the journald daemon. To see the logs that the journald daemon has collected, use the journalctl command.
#Display all Logs journalctl #Display Logs from a specific Unit journalctl -u sshd #Display Kernel messages (Similar to dmesg) journalctl -k #Display only error messages (and higher) journalctl -p err # Active Monitoring (Follow Logs, similar to tail -f) journalctl -f # Display only last 20 lines (Similar to tail -20) journalctl -n 20
Docker Basics
#Start docker and enable it to be started at boot time systemctl start docker systemctl enable docker #Download a Docker container (https://registry.hub.docker.com/) docker pull vmwarecna/nginx #Display local stored Docker images docker images #Start Docker Container # -d - Run the container in the background # -p 80:80 - Publish the container's port to the host docker run -d -p 80:80 vmwarecna/nginx #List running Docker Containers docker ps #Display the public-facing port that is NAT-ed to the container #(Container ID from docker ps command) docker port 5f6b0e03c6de #Stop Docker Container docker stop 5f6b0e03c6de #Automatically start Docker containers at boot time #To start a container at boot time the restart policy parameter is used. docker run --restart=always -d -p 80:80 vmwarecna/nginx
Pingback: Photon: linux by VMWARE | Ivan Zini
Thanks, and for to change keyboard layout map from qwerty to azerty ?
It is just terrible!!!! I live in Belgium and you need to install the full installation to change the keyboard because you need the localectl command.
Look at: https://communities.vmware.com/thread/511570?start=0&tstart=0
But still then I did often the following commands to change the keyboard to get the right keys (figures,=_) But the key for : I did not find. To quit the vi editor, I use ZZ.
For changing the network, I use "ip a" >> /etc/systemd/network/10.... and then change that file
localectl set-keymap=be-latin1
localectl set-keymap=uk
So, buy a querty keyoard for working on consoles. It is everywhere the same ....
It looks like there's no "nano" in Photon. Just use "vi" instead.
tdnf install nano
This did not work on my installation. My network device is called "ens3", not "eth0". Even if I set Name=* it still does not take the static IP configuration.
root@photon-machine [ ~ ]# tdnf install nano
Since systemd there are a lot of network interface name prefixes possible, e.g. enoX, ensX, enpXsY, enxX,...
To fetch the right one just perform an "ifconfig" command. To understand this behavior I strictly recommend the follwoing article:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/ch-Consistent_Network_Device_Naming.html