Quick Installation Guide for CoreOS on PC
Category Programming Technology
Purpose
To install and deploy the Linux operating system as quickly as possible. The installation is fast and simple, requiring almost no time to start running Docker. The system runs very fast, utilizing memory as a disk.
My Situation
I have a Win8 laptop for occasional gaming, but installing a dual-boot Linux system might take me a whole day. All my business operations can run in Docker, and my laptop has ample memory (16GB, thanks to Professor Jiang from HUST).
Preparation
- CoreOS image Download Link
- EasyBCD Download Link
Getting Started
- Install EasyBCD and add the ISO boot entry using CoreOS's livecd image Instructions
- Boot CoreOS to complete the CoreOS installation
Updates
Simply update the ISO file used for booting.
Drawbacks
- No persistence (Advantage: If something goes wrong, a simple reboot fixes it)
- The entire OS occupies disk space directly (Advantage: Significantly boosts disk speed)
- Manual mounting of disk space and running initialization scripts at each boot
This setup is recommended for specific business tasks. For more complex operations, more optimizations may be needed.
Configuration
- Create a 100GB partition on the disk and format it. Command:
mkfs.ext4 /dev/sda2
, then mount it. If you are unsure how to partition, format, and mount, refer to this guide. It's the best beginner's guide to disk management I've seen. - After mounting, copy the folder
/var/lib/docker/
to the mounted location and create a symbolic link back. This allows Docker images to persist across reboots. Commands:cp -rf /var/lib/docker /mnt/ rm -rf /var/lib/docker ln -s /mnt/docker /var/lib/docker
My Initialization Script Reference
mkdir /root/.ssh
echo "ssh-rsa xxx..(omitted)....xx [email protected]" > /root/.ssh/authorized_keys
rm -rf /var/lib/docker
ln -s /mnt/docker /var/lib/docker
#echo 'DOCKER_OPTS="--registry-mirror=http://XXXXX.m.daocloud.io"' >> /run/flannel_docker_opts.env
#systemctl daemon-reload
systemctl restart docker
# using disk
First, import the RSA key, then create a symbolic link to the Docker location.
Add DaoCloud acceleration (although the official documentation doesn't mention CoreOS, there are methods provided by experts). I found no need for acceleration, so it's commented out as a backup.
Pitfalls with systemd
If Docker returns an error -1, the container will crash. However, systemd also uses scopes.
When starting a problematic container, you might see:
Error response from daemon: Cannot start container test: [8] System error: Unit docker-e10eb86807cd9971fc03a8eee732771193d506ed2ba678fdf4292916a9fb072c.scope already exists.
To resolve this:
systemctl stop docker-e10eb86807cd9971fc03a8eee732771193d506ed2ba678fdf4292916a9fb072c.scope
CoreOS.iso Pitfall 2
Repeatedly confirming KnowHosts.
Solution reference: https://github.com/lijianying10/FixLinux/blob/master/note/取消sshPublicKeyKnowHost认证.md
Conclusion
Deploying Linux on a PC using this method is incredibly convenient. Those familiar with Docker can set it up according to their needs in about 20 minutes.
- To quickly resolve boot issues, use EasyBCD to boot from an ISO in memory instead of dealing with UEFI Grub.
- To reduce configuration time, switch from a standard installation to CoreOS.
- To avoid instability caused by incorrect operations or version upgrades, use Docker.
- In the future, consider switching to RKT, RunC (hoping the experts will fill in the gaps soon, as RunC is slated for release this month, though it might be delayed).
- Note that this approach prioritizes a minimal environment setup to save development time. Those who enjoy perfecting and tinkering might want to look elsewhere.
Source: http://www.philo.top/2015/07/16/pc-docker/
** Click to Share Notes
-
-
-