Use CentOS 7 on a VM for desktop purposes

Hello,
I'm Mandai, the Wild Team member of the development team.

I've finally updated my vagrant virtual environment to CentOS 7.
I'd like to move away from stuffing my development environment into a VM, but I'm still a bit used to it, so I haven't been able to switch over yet.

It took a bit of effort to get everything together, so I put together some work notes

2018/03/05 Some of the links in the rpm files retrieved by wget were broken, so we 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 automatically start it up

After that, you can reach the console either via SSH or by enabling gui.on = true in the Vagrantfile

Start with the default vagrant user (login as vagrant / vagrant)

Once you have successfully logged in, you can proceed to change your settings

 

Changing keyboard settings

On a US keyboard, it's difficult to find the colon, so the first thing I do is change the keymap

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 the convention is to change 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"

 

Changing the runlevel

Starting with CentOS 7, initd has been replaced by systemd.
Note that with systemd, the concept of runlevels is already outdated.
Instead, it is replaced by the concept of targets.

To change the boot target, you need to modify the following symbolic links accordingly,
which are located in /lib/systemd/system:

/etc/systemd/system/default.target


 However, since we are in a transitional period, targets corresponding to each runlevel are provided in /lib/systemd/system.
This is a design that is friendly to veterans.
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

If you look at the destination of the symbolic link, you can see what the runlevel was.
systemd doesn't just control runlevels, it replaces initd, so there is a lot of new knowledge that needs to be acquired, but I feel like there is no other way around it.

Incidentally, the introduction of systemd caused a great deal of turmoil in the Linux industry, and there was a lot of controversy.
Even our own Professor Linus seemed extremely angry, hurling a lot of vulgar language at the systemd developers, which is still fresh in our memory.
So, in fact, we're saying goodbye to chkconfig.
From now on, let's use the systemctl command instead of the chkconfig command!

 

Install git

Without git, you won't be able to get the source from the repository, so you'll need to install it

sudo yum -y install git

 

Install mozc

Now that I've talked about some pretty fundamental aspects of servers, like runlevels, I'll suddenly get a bit more casual, but when I type in Linux, I use mozc

Setting up mozc requires multiple rpms, and with CentOS 6 I created a batch file that compiled them all together and installed them in one go, but I couldn't install using the same rpms, so I searched for new rpms and ended up with this method.
The rpms required to use mozc via ibus are scattered in various places and are difficult to find, so to install them quickly, run the following command.

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


 The basic idea is to use the rpm for Fedora 19. If you look into it, you'll find a lot of information about the reason, but the bottom line is that CentOS 7 is built based on the code for Fedora 19 and Fedora 20.
The main reason to use the rpm for Fedora 19 is that the version of ibus installed on CentOS 7 is close to that of Fedora 19.

If you are replacing ibus, it may be possible to use the latest mozc (unconfirmed)


 2018/03/05 Addendum:
After leaving this for a long time, it seems that some RPMs are no longer available for download, so I changed the download source for the wget command above.
While it's usually searched for on rpm.pb.net, it's a pain to search every single time, so I've included the URL of the page with the RPM link.

Additional notes end here

 

Installing Google Chrome

Firefox is installed by default, but if you're doing web development, I think it's more convenient to use Chrome's Development Tool.
Chromium is fine, but I'd like to try Chrome, which is much easier to install than it was on CentOS 6.

When I was using CentOS 6, the glibc version was too low, so installing Chrome was quite a pain.
Automatic updates were not supported either.

From now on, just like Windows, you will be able to use the latest version automatically

All you need to do
is click the "Download Chrome" button on this download page

The page will automatically scan for your OS and provide you with a link to the correct rpm.
Select the rpm in the file to download and wait for the download to complete.

Once complete, double-click the rpm file in the file manager to launch the application installer. Press the Install button and once administrator privileges are authenticated, you're done!

 

So, do you do this every time?

This leads to the question, "How can I do this?"
If you want to do this kind of thing seriously, there are provisioning tools such as chef and ansible, but vagrant also has the option of using a shell script.
After all, you can do it with a text editor. It's very easy to use.

The following commands are a shell script that takes the work I have written down so far and turns it into a shell script

#! /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 that supports 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 setup is mostly complete, but there are some issues

  1. This means that the folder names of system-related directories in the user area (Desktop/Documents/Downloads, etc.) will be in Japanese
  2. I can't input Japanese using the half-width/full-width key

To address the first issue, first run the following command to display the dialog:

LANG=C xdg-user-dirs-gtk-update

 
Just click on the images in order

2016-10-11_14h34_31

To address the second issue, run the following command to display the dialog:

ibus-setup

 
Next, proceed through the dialogue in the order shown in the image

2016-10-11_15h03_23

2016-10-11_15h03_58

2016-10-11_15h04_22

2016-10-11_15h04_36

2016-10-11_15h04_54

Add mozc to your input sources. You can access it from the system tray in the top left

2016-10-11_14h12_37

2016-10-11_14h12_56

2016-10-11_14h13_15

2016-10-11_14h58_12

2016-10-11_14h59_31

Change the shortcut settings

2016-10-11_14h28_59

2016-10-11_14h29_14

2016-10-11_14h29_26

2016-10-11_14h29_59

Click on the area circled in red and press the Half-width/Full-width key

2016-10-11_14h31_14

It's simple, but it's surprisingly deep, so even if you know where it is, you can still get lost

 

(Bonus) Installing Visual Studio Code

This is the same procedure as Chrome.
It's a hot editor for me recently, so you should install it even if you don't use it.

the Visual Studio Code website, you will find a link to the rpm, so download the rpm and install it from the application installer.

On CentOS 6, it cannot be installed due to compatibility issues with the glibc version

 
That's all

If you found this article useful, please click [Like]!
0
Loading...
0 votes, average: 0.00 / 10
1,705
X Facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Yoichi Bandai

My main job is developing web APIs for social games, but I'm also grateful to be able to do a variety of other work, including marketing.
My portrait rights within Beyond are CC0.