VCSA 6.5 Basic Commands for VMware Photon
Enable SSH access for root
1 2 3 4 5 6 |
#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:
use this command to configure the network:
/opt/vmware/share/vami/vami_config_net
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#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 #Configure a service to be disable at boot time systemctl disable 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#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 |