All of the files were removed from /etc/yum.repos.d/ directory. How can I go about re-installing the default repos files that come with a fresh CentOS 7 install.
When I execute the following command "yum repolist all" I get the following result:
Loaded plugins: fastestmirror, landpacks
Loading mirror speeds from cached hostfile
repolist: 0
Thank you.
Rebuild your the default CentOS yum.repo.d folder
On a dev machine, somehow, I managed to erase my yum.repo.d contents. I wanted to rebuild the repo files back to their default. First you need to figure out what version you are using:
cat /etc/redhat-release
Then visit the correct release at : http://vault.centos.org/
navigate to the correct os/x86_64/CentOS/ directory (could be os/x86_64/CentOS/ i386/)
Download the following files to the server:
wget http://vault.centos.org/5.x/os/x86_64/CentOS/centos-release-notes-5.x-0.x86_64.rpm
wget http://vault.centos.org/5.x/os/x86_64/CentOS/centos-release-5-x.el5.centos.x86_64.rpm
Then install the two rpms:
rpm -Uivh *.rpm
Should be back to the original shipping repo files.
Credit: By jbmurphy on July 8, 2011 in Linux
Reference - http://www.jbmurphy.com/2011/07/08/rebuild-your-the-default-centos-yum-repo-d-folder/
Related
I am using Msys2 to run and compile c/nim programs, I cloned a repo that has a .nim file that I want to run but didn't have ceration packages such as nimcrypto so I used the command
nimble install nimcrypto
but got this error
$ nimble install nimcrypto
Prompt: No local packages.json found, download it from internet? [y/N]
Answer: y
Downloading Official package list
Tip: 5 messages have been suppressed, use --verbose to show them.
Error: Refresh failed
... Could not download: No SSL/TLS CA certificates found.
Where do I get these certificates from and how do I add them to nimble
downloaded nimble using this
downloaded nim using this
Nim Compiler Version 1.4.6 [Windows: amd64]
Compiled at 2021-05-03
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: 09db720eff0ec9e160debab126af37b1a4df296c
active boot switches: -d:release
Manually downloaded the cert to /usr/bin from this link
and this seems to solve the issue
I'm trying to install the commerce module in Drupal 8 however I get the error 'BC math PHP extension not found'.
I've searched for this problem and tried different things such as editing the PHP.ini by adding 'bcmath.scale=2' however I still get the error message.
Any help would be appreciated, thanks.
Just install bcmath plugin for your php version with no need to (re)build php as mentioned on accepted answer
# get php version
php -v
# install bcmath based on your version lets assume php 7.1
# for ubuntu
sudo apt install php7.1-bcmath
# for centos
yum install bcmath
# restart apache
sudo systemctl restart apache2
Above problem appears when installing commerce or commerce kickstart using composer
Update 2020
Please refer to #GiorgosK's answer for installing bcmath via a package manager if you are using a distribution that provides a bcmath package for PHP. I will ask the OP in comments to update the recommended answer, since that solution is probably what most people need.
Three years ago when I answered this question, I suggested that you have to rebuild PHP to get bcmath. That was incorrect. I was using an older distribution of Debian/Ubuntu that provided bcmath as a statically linked extension in the core php package. I determined at the time (incorrectly) that bcmath was a core extension that had to be enabled at build-time (like SPL and PCRE).
For those trying to troubleshoot a missing bcmath extension (such as those building/installing PHP themselves or nevertheless encountering issues), I've corrected and updated my original answer below. It explains in detail how to troubleshoot a missing PHP extension.
Original Answer (Corrected)
The error message indicates that PHP wasn't built with bcmath support or can't find the installed extension. PHP extensions are either built into PHP directly or they are loaded from an external dynamic library file at runtime.
Since PHP obviously doesn't have the extension built-in, it can't find the external library file that provides bcmath. This file on POSIX platforms will be called bcmath.so and php_bcmath.dll on Windows.
Extension files are installed under a directory indicated by the extension_dir property in php.ini. To determine the value of this property, run the following command:
php -r 'echo ini_get("extension_dir").PHP_EOL;'
The default value for this property is configured when PHP is built and may vary from distribution-to-distribution.
Once you verify the extension file is installed in this location, you can then check to see if the extension is enabled in php.ini. You should see a line that enables the extension like so:
# POSIX platforms
extension=bcmath.so
# Windows
extension=php_bcmath.dll
For Linux distributions like Ubuntu/Debian that install extensions via the package manager, the format is somewhat different since Debian employs a distributed configuration. Typically the package manager installs everything correctly, but you can check to see if an ini file exists for bcmath under the corresponding conf.d directory. These small ini files are snippets imported into the larger php.ini file, and they are typically symlinked to /etc/phpX/mods-available, allowing modules to be initially enabled for all PHP SAPIs such as CLI, CGI, Apache Mod PHP, ETC. Make sure a symlink exists for the PHP SAPI you need to use.
To ensure your PHP is loading the extension, run phpinfo(); in a test page and search for bcmath. You can also more easily do this with the CLI using a command like:
$ php -i | grep -i bcmath
# Success output: BCMath support => enabled
# (Another command that works well for checking extensions)
$ php -m | grep -i bcmath
# Success output: bcmath
In order for the CLI to show accurate results, it must target the same php.ini file. If it doesn't, then use the -c option to temporarily point the CLI at the correct php.ini (i.e. the one being used by your Drupal site).
Add BC MATH extension for PHP 7.2
If you are getting this (https://prnt.sc/sehmd5) error then, run below command using vagrant ssh
Run these command in root of vagrant ssh
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2-bcmath
service apache2 restart
Then open php.ini and search for bcmath
If bcmath scale is 0, Change it to 2
Restart php
Restart Apache
Hard Reload website
Install required modules
Similarly for any version of PHP, you only need to change PHP version in 3rd command.
First time use centos.
How to install centos 7 repos listed at https://centos.pkgs.org/
I would like to install newer version of some applications, such as NetworkManager which by default on my machine is 1.0.6 from pub-base.
From RedHat System Administrator Guide - 8.5 Configuring Yum and Yum Repositories
The configuration information for yum and related utilities is located
at /etc/yum.conf. This file contains one mandatory [main] section,
which enables you to set yum options that have global effect, and can
also contain one or more [repository] sections, which allow you to set
repository-specific options. However, it is recommended to define
individual repositories in new or existing .repo files in the
/etc/yum.repos.d/ directory. The values you define in individual
[repository] sections of the /etc/yum.conf file override values set in
the [main] section.
Then give a look at yum update and other yum Commands.
About repositories may be useful Available Repositories for CentOS.
I'm following the old tutorials off of gettingstartedwithdjango.com.
This series is quite old and I'm new to Django which is why I hit that site in the first place. It became my first introduction to Vagrant. Because the series is old and there are now new versions of Django, Vagrant, etc, I've found just getting through the first tutorial was quite difficult. This was mainly just the gap between Django v1.4 and the current version 1.9 which is what I'm running, including some syntax differences in settings.py and also some discrepancies between the text errata and the video which I had to sort through. It's a pretty detailed exercise if you're completely new to all of this (which I am), so it was quite challenging, and I was thrilled when after probably 12 hours of solid effort I was able to get everything working as was being described in the video but using all new versions of software. Once I got it all set up and working, I halted my Vagrant VM for the night and when I turned it back up (vagrant up) the next morning, I found that the VM would no longer mount its shared folders, essentially rendering the Vagrant VM useless to me as I'm then unable to run code which resides on the host machine (I'm running Windows 7) from within the VM (which is accomplished via the VirtualBox shared folders feature).
Not knowing what was wrong, this prompted me to completely reinstall my Vagrant VM. I was able to get things redeployed successfully with about one hour worth of effort, backtracking through steps I had taken to successfully complete the first tutorial in the first place, in order to back to the same point where I started (before I did the previous vagrant halt). When reinstalling the Vagrant VM I noticed messages that my VirtualBox Guest Additions (4.2.0) did not match the version of VirtualBox I have installed (5.0.10), which I recalled seeing the first time but ignored because it also said this isn't usually a problem and should work (if it weren't for bad luck, I'd have no luck at all). Since for me it didn't work, this led me down a whole rabbit hole of posts from various websites including SO, which ultimately had me updating my Vagrant VM, downloading/mounting/building/installing a new version of VirtualBox Guest Additions, and reloading my Vagrant VM only to wind up in the same boat. Shared folders were still not working!
To be very specific, this is more or less what I tried based on information from many websites:
cd /home/vagrant
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install dkms build-essential linux-headers-generic
sudo apt-get install linux-headers-3.2.0-23-generic
# mounted VBoxGuestAdditions_5.0.10.iso to Vagrant VM
cd /media/cdrom
sudo sh ./VBoxLinuxAdditions.run
sudo reboot
sudo /etc/init.d/vboxadd setup
sudo reload
c:\VAGRANT\vagrant plugin install vagrant-vbguest
c:\VAGRANT\vagrant reload
I was utterly convinced this was going to resolve the issue but it didn't.
Then I found this gem:
http://ddelizia.blogspot.com/2011/02/how-to-share-folder-on-virtual-box-with.html
This shows how to, from within the Vagrant VM, mount the shared folders back to your Windows 7 host. To be specific, here's what I did when I found things were working again:
cd /vagrant
ls -la
<this yielded nothing>
sudo mount.vboxsf vagrant /vagrant # see your VirtualBox Shared Folders settings
cd ~ # /home/vagrant
cd - # /vagrant
ls -la
# this yielded the expected folders from my Win7 host
In the mount.vboxsf command above, the first vagrant (without the /) came from the Name column in my VirtualBox shared folders settings. This is essentially an alias which is used to refer to the actual path on the Win7 host, in my case: C:/VAGRANT. The second vagrant (with the /) in that command is the /vagrant folder on the Vagrant VM (linux).
Given that I spent most of today messing with this and I figure there are plenty of people who are going to run into this same or related problem, I thought I would try to help out and save you all a bunch of time. Good luck.
This is not about vagrant or virtualbox guest running slowly due to slow shared folder access, we know that can be resolved more or less by enabling nfs.
It's rather about mounted shared folder go out of sync when there are many file operations within the vm (enable nfs does not prevent it from happening) .
For example, when we are installing packages, like with php composer or node.js npm inside the vm, there is a certain probability that normal composer update or npm install will fail, and once it failed, only vagrant reload will help to restore the sync folder and allow the same command to pass without problem.
Such random failure only happens when executing on shared folder (nfs or not), so apt-get upgrade won't trigger the same problem as it runs within the vm folders.
Since the same sync problem does not appear when we run composer or npm from the host server, I am wondering what could have caused it and how do we go about debugging it?
Our vagrant setup and config:
if Vagrant::Util::Platform.windows?
config.vm.synced_folder "www", "/var/www", :extra => "dmode=777,fmode=777", :owner => "vagrant", :group => "vagrant"
else
config.vm.synced_folder "www", "/var/www", :extra => "dmode=777,fmode=777", :nfs => true
end
Guest: Ubuntu 12.04 LTS x64
Host: Windows 8, Mac OSX 10.8, Ubuntu 13 (yes, they all run into the same problem randomly)
Think we have more or less discover the source of problem:
Guest Addition version (4.1.x) that comes with our Ubuntu 12 LTS box does not match current Virtualbox version (4.2.x) installed on host machine. So file sync failed.
The easy fix:
run this command within vm sudo apt-get -y -q purge virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11 to remove old guest addition
install vagrant vbguest plugin so future update is taken care of automatically during up: https://github.com/dotless-de/vagrant-vbguest