On the title, really cry, I a man almost be urgent cry, two days and two nights ah, I did not do other, in order to solve the problem below

Public account: Java Architects Association, updated daily technical good articles

This is an error code prompt, and the reason is only because of a command, yum -y install wget

Error: Cannot retrieve repository metadata (repomd.xml) for repository: bas
e. Please verify its path and try again
Copy the code

I don’t know if any centos6 users like me have encountered this problem recently. The reason is that I think the download speed of the private virtual machine opened by the company to us is really slow. After applying for permission, I wanted to change the source, and then I found that the new virtual machine can’t download Wget, and other yum commands can’t either. Yum Clean All and yum Makecache have been checked several times, but I thought I had broken it. Fortunately, there was no problem with normal business access except that I could not access the source, so I had to contact the engineer. Then, last night, I received a message from the engineer: Centos6 has stopped updating, tsinghua, Ali, netease and other yum libraries have been closed, visit the official website to see the official website has been introduced

CentoS 6 Stop maintenance update date = November 30, 2020 CentoS 7 Stop maintenance update date = June 2024 CentoS 8 Stop maintenance update date = May 2029Copy the code

Then there was a conversation between two crooked programmers

Engineer eldest brother: you boy how so dot back, this just stop to maintain a week let you boy meet with

. I, you, am I happy? What am I supposed to do

I asked eldest brother: How to deal with this matter

Eldest brother one face see idiot expression look at me: you boy meng, already stopped to maintain, I can how to do, change 7 bai, later you use 7

Then a face sinister smile of expression looking at me, I say: elder brother, don’t look at me like this, have a little hair hair, you zha?

Eldest brother said: although 67 two versions of the change is not big, but there are always some differences, you used to use 6, suddenly change 7 will not adapt to ah?

Emmmm, I am staring at the back of my big brothers leaving, and it seems to be true. Therefore, with this article today, I will explain the following aspects, mainly including the basics of network, time, common commands, environment variables, and how to improve Centos6 and persist for a while

The network configuration

Get a new centos system, the first thing to operate is network configuration, especially in their OWN PC for virtual machine configuration, in fact, normal no problem, but there are some differences, let’s take a look

New nic name is also changed to ens33Copy the code

The network configuration is almost identical to 6

/etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static IPADDR=192.168.79.7 NETMASK=255.255.255.0 GATEWAY=192.168.79.2 DNS1=114.114.114.114 DNS2=192.168.79.2 ZONE= DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=c220bec2-8a7e-414a-9ea6-b20f87fa8485 DEVICE=ens33 ONBOOT=yesCopy the code

There are also host name changes. In centos7, host names can be changed in two ways

1. Modify the configuration file directly

2. Command operation

2. Run the hostnamectl set-hostname command to change the hostname permanently.Copy the code

Restart to take effect


Once configured, the simple operations are done, the network communication is successful, and the next operations can be performed in Xshell

So what are some other commands that centos6 and Centos7 that we use a lot in our daily lives but slightly different

Service process

Centos6 uses service and chconfig to manage services. Centos7 uses systemctl to manage services, but the service and chkconfig commands can also be used

Take the firewall as an example

Centos7 Operates the firewall

Systemctl status Firewald. service // Check the status of the firewall for preventing the DAO. Run the systemctl stop firewalld.service command to disable the running firewall systemctl status firewalld.service command to check the firewall status. If disavtive (Dead) is displayed, The firewall is disabled: systemctl disable firewalld.service // The firewall service is permanently disabled even after the next restartCopy the code

Time area operation

Time synchronization

[root@node1 yum.repos.d]# chrony
-bash: chrony: command not found
[root@node1 yum.repos.d]# chronyc sources
-bash: chronyc: command not found
[root@node1 yum.repos.d]# yum install -y chrony
Copy the code

Note: there are also some commands that you need to install and use, but here you can use yum.

# note: When the installation is complete, Service [root@node1 yum. Repos. D]# systemctl start chronyd.service [root@node1 yum chronyd.serviceCopy the code

[root@node1 yum. Repos. D]# chronyc sources -vCopy the code

Modify the time

$ timedatectl set-timezone Asia/Tokyo
$ timedatectl status
Copy the code

The original time

[root@node1 yum.repos.d]# timedatectl set-timezone Asia/Tokyo

The modified

Modify the area

$ localectl set-locale LANG=ja_JP.utf8

$ localectl status

service

Service in

$systemctl list-unit-files $systemctl --type service Forcibly stop $systemctl kill --signal=9 SSHDCopy the code

The environment variable

This is because I was prompted to say Common Not found when USING JPS

Then I remembered that I hadn’t configured the environment variables yet, because centos7 came with an open-jdk, so when I uploaded it and configured the environment variables the traditional way, it didn’t work

Because of some changes,.bashrc cannot be configured, but **/etc/profile** is still the same

There are also some differences in the configuration of environment variables, for the following, only need to add the path on its own basis

PATH = $PATH: $HOME/bin: / opt/software/jdk1.8 / bin export PATHCopy the code

Then it’s ok, I rewrote it myself, because I just got to know Centos7, I still don’t understand all the places, if you know how this place is, you can discuss it in the comments section, hey, hey, hey

Because it happened suddenly, and these are the basic configuration that we often use in daily work and study, such as network, Java, firewall, etc., and many of the commands are almost the same as Centos6, general, so here is not too much introduction, in the daily work project can pay a little attention to sum up


Of course, some of you may still need to use Centos6 first. If you find a problem, you can simply upgrade to the new system. However, as mentioned earlier, if the yum source is already closed, there is a temporary solution. This can be done with vault.centos.org as a surprise update source!!

CentOS official: Vault.centos.org/

Ali cloud mirror: mirrors.aliyun.com/centos-vaul…

The solution

Vi/etc/yum/pluginconf d/fastestmirror. Conf # modify parameters enable = 0, if you don't close the priority or go back to the source repository to see # backup original files, backup is definitely a good habit, Repos. D/centos-base. Repo /etc/yum-repos. D/centos-base /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Official.repo # replace with Ali Cloud Vault image wget  -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Aliyun.repoCopy the code

But some friends may just use centos6, or because of various reasons, there is no install wget, how to do, it doesn’t matter, you can use the address on the surface content, directly edit the original Yum source file and replace can (note: this way, a best and cp, otherwise the late problems have no replacement, backup or can)

conclusion

Good, basic here, today, I was over, the content of the summary of some commonly used commands in different versions of centos difference, in the later can better use in daily work, improve their ability, however, this also is in daily work not study summarizes the consequences, before, I have also seen centos7 command, however, 6 is so unique that it directly shuts down all the sources, which is quite unexpected. In the later period, when we go to learn about centos8, we really need to sum up

Well, it’s been a very full night, I didn’t know this stuff was for youBaa hasHelp, helpful words forward attention to it, thank you