PhotonOS
The default password for the root account is changeme
Usage
Tiny DNF for Package Management
# Install Photon OS patches
tdnf update
tdnf upgrade
# IP address setup
cat "
[Match]
Name=e*
[Network]
DHCP=no
Address=192.168.0.10/24
Gateway=192.168.0.1
DNS=8.8.8.8 9.9.9.9
Domains=mydomain.local
NTP=0.pool.ntp.org 1.pool.ntp.org
" > /etc/systemd/network/10-static-en.network
If you want to change the host name, please do so in /etc/hostname
reboot and check the ip address, using ip a
Add a new user and install Sudo
# Activate SUDO
tdnf install sudo
# Then add a new user that will be able to use sudo.
useradd -m -G sudo <username> # (-m creates the home directory /home/user; -G adds the user to the sudoers group)
# set the password for the new user
passwd <username>
sudo without password
sudo su -
echo "`whoami` ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/sudoers
"`whoami` ALL=(ALL) NOPASSWD: NOPASSWD: ALL"
# setup user login over ssh
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
# add your public key into authorized_keys
# disable password login
# update value in /etc/ssh/sshd_config
# To disable tunneled clear text passwords, change to no here!
# PasswordAuthentication * => PasswordAuthentication no
# PermitEmptyPasswords * => PermitEmptyPasswords no
# ChallengeResponseAuthentication * => ChallengeResponseAuthentication no
# UsePAM * => UsePAM no
# disbale root login
# PermitRootLogin * => PermitRootLogin no
sudo systemctl restart sshd
Docker
# Run docker withour sudo
sudo groupadd docker
sudo usermod -aG docker $USER
# Enable Docker
sudo systemctl enable docker
sudo systemctl start docker
# Install Docker-Compose
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)
curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
Enable remote access
#update /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H fd:// --containerd=/run/containerd/containerd.sock
sudo systemctl daemon-reload
sudo systemctl restart docker
Monitor Photon OS
curl -O https://dl.influxdata.com/telegraf/releases/telegraf-1.16.0_linux_amd64.tar.gz
Frequently Asked Questions
Q: How can I monitor the Docker Engine Host from within a container?
You will need to setup several volume mounts as well as some environment variables:
docker run --name telegraf
-v /:/hostfs:ro
-v /etc:/hostfs/etc:ro
-v /proc:/hostfs/proc:ro
-v /sys:/hostfs/sys:ro
-v /var/run/utmp:/var/run/utmp:ro
-e HOST_ETC=/hostfs/etc
-e HOST_PROC=/hostfs/proc
-e HOST_SYS=/hostfs/sys
-e HOST_MOUNT_PREFIX=/hostfs
telegraf