This script has been tested on centos linux only current os

Unable to use yum on CentOS 7

I have install CentOS 7 on hyper-v successfully, but when I try to update using yum update or try to install using the yum command I have the below error:

Loaded plugins: fastestmirror, langpacks Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 12: Timeout on http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock: (28, 'Resolving timed out after 30425 milliseconds') One of the configured repositories failed (Unknown), and yum doesn't have enough cached data to continue. At this point the only safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working upstream. This is most often useful if you are using a newer distribution release than is supported by the repository (and the packages for the previous distribution release still work). 3. Disable the repository, so yum won't use it by default. Yum will then just ignore the repository until you permanently enable it again or use --enablerepo for temporary usage: yum-config-manager --disable 4. Configure the failing repository to be skipped, if it is unavailable. Note that yum will try to contact the repo. when it runs most commands, so will have to try and fail each time (and thus. yum will be be much slower). If it is a very temporary problem though, this is often a nice compromise: yum-config-manager --save --setopt=.skip_if_unavailable=true Cannot find a valid baseurl for repo: base/7/x86_64` 

Источник

Читайте также:  Наиболее распространенные дистрибутивы linux

Yum update problems on CentOS 6.5 minimal as VMware guest

INFO: I am using Windows 7 Pro (64bit) with VMware Workstation version 10.0.1 . I am using CentOS(64bit) 6.5 minimal, for the first time. I am running this from my workplace network, which may use a proxy server. Background: I have been following this tutorial (http://1stopit.blogspot.com/2013/11/creating-centos-64-minimal-vm-with.html) As recommended in the tutorial, I configured the VM to used bridged networking, rather than NAT (which is the default). At first, when trying to run yum update I received a PYCURL ERROR 6, it looked like this:

Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile could not retreive mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'" Error: Cannot find a valid baseurl for repo: base 

Then I tried to run ping mirrorlist.centos.org , which resulted in ping:unknown host mirrorlist.centos.org Then I tried: ifdown eth0 then ifup eth0 , which yielded: Determining IP information for eth0. failed. This below is the current contents of my file at /etc/sysconfig/network-scripts/ifcfg-eth0 :

DEVICE=eth0 HWADDR=xx:xx:xx:xx:xx:xx TYPE=Ethernet UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=dhcp 

(I didn’t know if I should be showing my HWADDR and UUID, so I left it anonymous) Since I am trying to run this from my workplace(which may use a proxy server), I thought I would try the recommendations here https://unix.stackexchange.com/a/93428/60724, and edit /etc/yum.conf , I added proxy=http://xxx.xxx.xx.xx:8080 , here is the full file of yum.conf:

[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php? project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release proxy=http://xxx.xxx.xx.xx:8080 #comments #metadata_expire=90 

Then after that when I tried to run yum update , I started to receive PYCURL Error 5, rather than PYCURL Error 6, see this:

running yum update results in: Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile 4&repo=os error was 14: PYCURL ERROR 5 - "Couldn't resolve proxy 'xxx.xxx.xx.xx'" Error: Cannot find a valid baseurl for repo:base 

Источник

Читайте также:  Linux set current time

Разворачиваем rConfig on CentOS 7

Все было хорошо в компании до тех пор, пока не пришел самый умный начальник, который забраковал все наши Mikrotik и как они настроены, слушать ничего не хотел и выбил деньги правда на б/у шные Cisco . Купили, я их настроил, теперь пора выбора средства, через которое снимать резервную копию. Правда этого начальника уволили потом, больше балабол чем практик.

Для цели резервного копирования у меня есть скрипт на связке bash + expect , вот только он порой работает, а порой в назначенное время на консоль не передаются строки, которые отслеживаются и вместо нужных команд отправляются другие. Такое было пару раз, но из-за этого я не могу оставить сервис и приходится самим следить.

В следствии этого поиск вывел меня на утилиту rConfig , правда адаптированную под CentOS + Web интерфейс. И вот ради этого придется вспомнить, как работать с CentOS.

Все ниже указанное отрабатываю под виртуализацией Debian 10 + Proxmox 6.4-13 и виртуальной машиной CentOS 7 (CentOS-7-x86_64-Minimal-2009.iso)

Под виртуальную машину у меня выделено:

Системные требования под сервис rConfig опубликованные на официальном сайте:

Minimum Requirements

  • Centos 7+
  • PHP 7+
  • MySQL 5.6+
  • Apache 2.4+
  • Browser IE7+, Firefox3.5+, Chrome11+, Safari3+, Opera 9.4+

Шаг №1: Подключаюсь по SSH к Ubuntu 22.04 Server к системе с CentOS 7:

Источник

How to know if the running platform is Ubuntu or CentOS with help of a Bash script?

How do I get the output from the terminal and compare to see if it is UBUNTU or CENTOS and perform the following commands?

Ubuntu 14.04

14 Answers 14

Unfortunately, there is no surefire, simple way of getting the distribution name. Most major distros are moving towards a system where they use /etc/os-release to store this information. Most modern distributions also include the lsb_release tools but these are not always installed by default. So, here are some approaches you can use:

# Determine OS platform UNAME=$(uname | tr "[:upper:]" "[:lower:]") # If Linux, try to determine specific distribution if [ "$UNAME" == "linux" ]; then # If available, use LSB to identify distribution if [ -f /etc/lsb-release -o -d /etc/lsb-release.d ]; then export DISTRO=$(lsb_release -i | cut -d: -f2 | sed s/'^\t'//) # Otherwise, use release info file else export DISTRO=$(ls -d /etc/[A-Za-z]*[_-][rv]e[lr]* | grep -v "lsb" | cut -d'/' -f3 | cut -d'-' -f1 | cut -d'_' -f1) fi fi # For everything else (or if above failed), just use generic identifier [ "$DISTRO" == "" ] && export DISTRO=$UNAME unset UNAME 
$ gcc --version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54) Copyright (C) 2006 Free Software Foundation, Inc. 
$ gcc --version gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3) Copyright (C) 2010 Free Software Foundation, Inc. 
$ gcc --version gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. 
$ gcc --version gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

This has basically been directly copied from @slm’s great answer to my question here.

Читайте также:  Linux узнать имя удаленного компьютера

Источник

Оцените статью
Adblock
detector