Access single user mode (reset root password)

To reset the root password of your server, you will need to boot into single user mode.

Access the Manage section of your server in the customer portal and follow these steps. The option depends on the bootloader version on the machine:

CentOS 6

  1. Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
  2. You will see a GRUB boot prompt telling you to press any key – you have only a few seconds to press a key to stop the automated booting process. (If you miss this prompt you will need to restart the VM again)
  3. At the GRUB prompt, type A to append to the boot command.
  4. Add the text single and press ENTER.
  5. The system will boot and you will see the root prompt. Type passwd to change the root-password and then reboot again.

CentOS 7

  1. Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
  2. As soon as the boot process starts, press ESC to bring up the GRUB boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB boot prompt.
  3. You will see a GRUB boot prompt – press E to edit the first boot option. (If you do not see the GRUB prompt, you may need to press any key to bring it up before the machine boots)
  4. Find the kernel line (it starts with “linux16”), change ro to rw init=/sysroot/bin/sh.
  5. Press CTRL+X or F10 to boot single user mode.
  6. Access the system with the command: chroot /sysroot.
  7. Run passwd to change the root password.
  8. Reboot the system: reboot -f.

Debian, Ubuntu

  1. Click [View Console] to access the console and click the send CTRL+ALT+DEL button on the top right. Alternatively, you can also click [RESTART] to restart the server.
  2. As soon as the boot process starts, press ESC to bring up the GRUB boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB boot prompt.
  3. You will see a GRUB boot prompt – press E to edit the first boot option. (If you do not see the GRUB prompt, you may need to press any key to bring it up before the machine boots)
  4. Find the kernel line (it starts with linux /boot/) and add init=/bin/bash at the end of the line.
  5. Press CTRL+X or F10 to boot.
  6. The system will boot and you will see the root prompt. Type mount -o remount,rw / and then passwd to change the root password and then reboot again.

FreeBSD

The boot menu has an option to boot into single-user mode. Press the key for single user mode 2. At the root prompt, type passwd to change the root password and then reboot again.

Source

Docker Swarm Visualizer

Setelah kemaren bahas Docker Swarm lab, kali ini kita akan coba Swarm Visualizer, semacam web GUI untuk melihat Swarm.

Lab kali ini masih lanjutan dari Lab Docker Swarm Cluster.

Install unzip

[email protected]:~$ sudo apt install unzip
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'sudo apt autoremove' to remove it.
Suggested packages:
zip
The following NEW packages will be installed:
unzip
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 167 kB of archives.
After this operation, 558 kB of additional disk space will be used.
Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 unzip amd64 6.0-21ubuntu1 [167 kB]
Fetched 167 kB in 2s (78.5 kB/s)
Selecting previously unselected package unzip.
(Reading database … 60376 files and directories currently installed.)
Preparing to unpack …/unzip_6.0-21ubuntu1_amd64.deb …
Unpacking unzip (6.0-21ubuntu1) …
Processing triggers for mime-support (3.60ubuntu1) …
Setting up unzip (6.0-21ubuntu1) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …

Setelah itu download docker swarm visualizer

[email protected]:~$ wget https://github.com/dockersamples/docker-swarm-visualizer/archive/master.zip

Kemudian extract

[email protected]:~$ unzip master.zip

Ubah nama directory menjadi dockersample

mv docker-swarm-visualizer-master dockersamples

Jalankan perintah docker

[email protected]:~$ docker run -it -d -p 5000:8080 -v /var/run/docker.sock:/var/run/docker.sock dockersamples/visualizer
Unable to find image 'dockersamples/visualizer:latest' locally
latest: Pulling from dockersamples/visualizer
cd784148e348: Pull complete
f6268ae5d1d7: Pull complete
97eb9028b14b: Pull complete
9975a7a2a3d1: Pull complete
ba903e5e6801: Pull complete
7f034edb1086: Pull complete
cd5dbf77b483: Pull complete
5e7311667ddb: Pull complete
687c1072bfcb: Pull complete
aa18e5d3472c: Pull complete
a3da1957bd6b: Pull complete
e42dbf1c67c4: Pull complete
5a18b01011d2: Pull complete
Digest: sha256:54d65cbcbff52ee7d789cd285fbe68f07a46e3419c8fcded437af4c616915c85
Status: Downloaded newer image for dockersamples/visualizer:latest
765b970ff0010e0956fb2bf002861a04a290f04ef3d6980afed31f2609b38b71

Sekarang kita akan coba membuat service nginx dengan 3 replika

[email protected]:~$ docker service create --name my-web1 --publish 8080:80 --replicas 3 nginx
xsvgsuh3nsxg2ogg1wbqptj9f
overall progress: 3 out of 3 tasks
1/3: running
2/3: running
3/3: running
verify: Service converged

Cek service nginx jalan

Sekarang buka web browser, untuk melihat Swarm Visualizer (pada lab kali ini menggunakan port 5000)