Using CentOS7 launched on a VM for desktop purposes
Hello.
I'm Mandai, in charge of Wild on the development team.
I finally updated the virtual environment used by vagrant to CentOS7.
I'd like to stop using the pattern of putting the development environment inside a VM, but I haven't been able to make the switch yet because I just learned about it.
It took some time to get everything together, so I put together a work memo.
2018/03/05 Some of the rpms picked up by wget had broken links, so I changed them to the URL of an alternative server.
Try starting the VM via vagrant
If you use vagrant, just run the following command and it will start automatically.
vagrant init centos/7; vagrant up
The above command will download the VM image on atlas and proceed automatically until it starts.
After that, you can reach the console by SSH or by enabling gui.on = true in Vagrantfile.
Start working with the default vagrant user. (Login with vagrant / vagrant)
If you can log in successfully, proceed to change settings.
Change keyboard settings
If you use a US keyboard, you will have a hard time finding the colon, so change the keymap on your first try.
sudo localectl set-keymap jp106 sudo localectl set-keymap jp-OADG109A
Language settings
Since we are building it for desktop use, we will also set the language. It seems that it has become good manners to rewrite LANG via localectl.
sudo localectl set-locale LANG=ja_JP.utf8
desktop installation
I also want a GUI, so I'll install the package.
sudo yum -y groupinstall "GNOME Desktop"
Change runlevel
Starting with CentOS7, initd has been replaced by systemd.
When it comes to systemd, the concept of runlevels is already behind the times, so be careful.
Instead, the concept changes to a target.
To change the startup target, you need to modify the following symbolic links accordingly.
The link destination is provided in /lib/systemd/system.
/etc/systemd/system/default.target
However, since this is a transition period, targets corresponding to each runlevel are provided in /lib/systemd/system.
It's a rotor-friendly design.
Below is a list of targets corresponding to runlevels.
runlevel0.target -> poweroff.target |
runlevel1.target -> rescue.target |
runlevel2.target -> multi-user.target |
runlevel3.target -> multi-user.target |
runlevel4.target -> multi-user.target |
runlevel5.target -> graphical.target |
runlevel6.target -> reboot.target |
You can tell what the runlevel is by looking at the destination of the symbolic link.
systemd does not only control runlevels, but also replaces initd, so there is a lot of new knowledge that needs to be acquired, but I feel like this is inevitable.
By the way, when introducing systemd, there was a lot of turmoil in the Linux industry, and a lot of things went wrong.
It's still fresh in my memory that our Professor Linus was also very angry and was hurling a lot of vulgar words at the systemd developers.
That's why I'm actually saying goodbye to chkconfig.
From now on, use the systemctl command instead of the chkconfig command!
install git
If you don't have git, you won't be able to fetch sources from the repository, so install it.
sudo yum -y install git
install mozc
After talking about the basics of the server, such as runlevels, this will suddenly become more casual, but I use mozc to input text on Linux.
Setting up mozc requires multiple rpms, and when I was using CentOS6, I created a batch file that combined them and installed them all at once, but I couldn't install them using the same rpm, so I created a new one. I searched around for rpm and came up with this method.
The rpms required to use mozc via ibus are scattered in various places and difficult to understand, so run the following command to install them immediately.
wget ftp://mirror.switch.ch/pool/4/mirror/centos/7.4.1708/os/x86_64/Packages/protobuf-2.5.0-8.el7.x86_64.rpm wget ftp://ftp.pbone .net/mirror/archive.fedoraproject.org/fedora/linux/releases/19/Everything/x86_64/os/Packages/z/zinnia-0.06-16.fc19.x86_64.rpm wget ftp://ftp.pbone.net /mirror/archive.fedoraproject.org/fedora/linux/releases/19/Everything/x86_64/os/Packages/z/zinnia-tomoe-0.06-16.fc19.x86_64.rpm wget ftp://ftp.pbone.net /mirror/archive.fedoraproject.org/fedora/linux/releases/19/Everything/x86_64/os/Packages/i/ibus-mozc-1.10.1390.102-1.fc19.x86_64.rpm wget ftp://ftp.pbone .net/mirror/archive.fedoraproject.org/fedora/linux/releases/19/Everything/x86_64/os/Packages/m/mozc-1.10.1390.102-1.fc19.x86_64.rpm sudo yum localinstall -y ibus-mozc -1.10.1390.102-1.fc19.x86_64.rpm mozc-1.10.1390.102-1.fc19.x86_64.rpm protobuf-2.5.0-8.el7.x86_64.rpm zinnia-0.06-16.fc19.x86_64.rpm zinnia -tomoe-0.06-16.fc19.x86_64.rpm
Basically, use rpm for Fedora19. If you look into the reason, you'll find a lot of information, but the bottom line is that CentOS7 is built based on the code of Fedora19 and Fedora20.
The biggest reason to use the Fedora19 rpm is that the version of ibus installed on CentOS7 is close to Fedora19.
If you are replacing ibus, it may be possible to use the latest mozc (unconfirmed).
2018/03/05 Addendum
After leaving it for a long time, it seems that some RPMs that cannot be downloaded have appeared, so I changed the download source of the wget command slightly above.
Basically, you can search from rpm.pb.net, but since it is a pain to search each time, I will also paste the URL of the page that contains the RPM link destination.
P.S. So far
Installing Google Chrome
Firefox is installed by default. If you're looking to do web development, I think it's more convenient to use Chrome's Development Tool.
Chromium would be fine, but I would like to use chrome, which is much easier to install than on CentOS6.
When I was using CentOS6, the version of glibc was too low, so installing chrome was quite a pain.
Automatic updates were also not supported.
From now on, just like Windows, you will automatically be able to use the latest version.
All you have to do
is click the "Download Chrome" button from this download page
The page will automatically read your OS and link you to the correct rpm.
Select the rpm in the file you want to download and wait until the download is complete.
Once completed, double-click the rpm file from the file manager and the application installer will start, so press the install button, and once you are authenticated as an administrator, you are done!
So, do you do this every time?
This leads to the question.
If you want to do something like this, there are provisioning tools like chef and ansible, but Vagrant also has a shell script option.
After all, you can do it with a text editor. It feels easy.
The following commands are a shell script of the hard work I've done so far.
#! /bin/bash # install chrome function install_chrome { cat << CHROME > /etc/yum.repos.d/google-chrome.repo [google-chrome] name=google-chrome - \$basearch baseurl=http:/ /dl.google.com/linux/chrome/rpm/stable/\$basearch enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub CHROME sudo yum -y install google -chrome-stable } # install mozc function install_mozc { cd ~ cat << MOZC > mozc_required_rpms.txt ftp://mirror.switch.ch/pool/4/mirror/centos/7.4.1708/os/x86_64/Packages/protobuf -2.5.0-8.el7.x86_64.rpm ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/19/Everything/x86_64/os/Packages/z/zinnia- 0.06-16.fc19.x86_64.rpm ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/19/Everything/x86_64/os/Packages/z/zinnia-tomoe-0.06 -16.fc19.x86_64.rpm ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/19/Everything/x86_64/os/Packages/i/ibus-mozc-1.10. 1390.102-1.fc19.x86_64.rpm ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/19/Everything/x86_64/os/Packages/m/mozc-1.10.1390.102 -1.fc19.x86_64.rpm MOZC xargs -P 10 -n 1 wget -nv < mozc_required_rpms.txt sudo yum localinstall -y ibus-mozc-1.10.1390.102-1.fc19.x86_64.rpm mozc-1.10.1390.102-1 .fc19.x86_64.rpm protobuf-2.5.0-8.el7.x86_64.rpm zinnia-0.06-16.fc19.x86_64.rpm zinnia-tomoe-0.06-16.fc19.x86_64.rpm && \ rm -f ibus- mozc-1.10.1390.102-1.fc19.x86_64.rpm mozc-1.10.1390.102-1.fc19.x86_64.rpm protobuf-2.5.0-8.el7.x86_64.rpm zinnia-0.06-16.fc19.x86_64.rpm zinnia-tomoe-0.06-16.fc19.x86_64.rpm mozc_required_rpms.txt } # change keyboard setting function change_keymap { sudo localectl set-keymap jp106 sudo localectl set-keymap jp-OADG109A # Change to keymap compatible with windows keys } # change localectl function change_locale { sudo localectl set-locale LANG=ja_JP.utf8 } # Install GNOME Desktop function install_gnome_desktop { sudo yum -y groupinstall "GNOME Desktop" } function change_default_target { cd /etc/systemd/system sudo ln -sf /lib/ systemd/system/graphical.target default.target } change_locale change_keymap install_gnome_desktop && change_default_target install_chrome install_mozc
Thank you for your opinion that we should release it from the beginning!
The initial settings are almost complete, but there are some problems.
- The folder names of system-related directories (Desktop/Documents/Downloads, etc.) in the user area are in Japanese.
- Cannot input Japanese using half-width/full-width keys
To deal with the first problem, first run the following command to display the dialog.
LANG=C xdg-user-dirs-gtk-update
Just click on the images in order.
To deal with the second problem, run the following command to display a dialog.
ibus-setup
Next, proceed through the dialog in the order of the images.
Add mozc to your input sources. It can be accessed from the system tray in the top left.
Also change the shortcut settings.
Click the area circled in red and press the half-width/full-width key.
It's simple, but it's surprisingly deep, so even if you know about it, you'll still get lost.
(Bonus) Installing Visual Studio Code
This is also the same procedure as for chrome.
It's a hot editor for me lately, so it's a must-install even if you don't use it.
the Visual Studio Code site, there is a link to the rpm, so download the rpm and install it from the application installer.
On CentOS6, it cannot be installed due to the glibc version.
That's it.