How to clear the YUM cache
How to clear the YUM cache
What is yum?
The Yellowdog Updater, Modified (yum) is an open-source command-line package-management utility for Linux operating systems using the RPM Package Manager. Yum allows automatic updates, package and dependency management, on RPM-based distributions. Like the Advanced Packaging Tool (APT)
How to clear the yum cache:
When a package is downloaded, installed and is removed there is a chance that the package may still be saved/stored in the yum’s cache. So to clean all the cached packages from the enabled repository cache directory, login as root and execute the following:
#yum clean packages
To purge the old package headers information completely, execute the execute the command below:
#yum clean headers
To clean metadata for each enabled repository, execute the command below:
#yum clean metadata
If you wish to clean all the cached files from any enabled repository at once, execute the command:
#yum clean all
Mount an NTFS drive on CentOS 7
Mount an NTFS drive on CentOS 7
NTFS-3G
NTFS-3G is a stable, open source, GPL licensed, POSIX, read/write NTFS driver for Linux. It provides safe handling of the Windows XP, Windows Server 2003, Windows 2000, Windows Vista, Windows Server 2008 and Windows 7 NTFS file systems.
NTFS-3G can create, remove, rename, move files, directories, hard links, and streams.
To mount an NTFS drive, start off by adding the remi-release and epel-release repos to your installation
Epel Repo: https://fedoraproject.org/wiki/EPEL
#yum install epel-release
Remi Repo: https://rpms.remirepo.net
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm
How Do I Install NTFS-3G
Issue the following command to install
#yum install ntfs-3g
You also need the Fuse package but it’s usually pre-installed on CentOS, just verify if it’s installed or not
#yum install fuse
Load the module
#modprobe fuse
List the attached drives to find the NTFS drive to mount
#fdisk -l - show all drive
How Do I Find Out NTFS Partition Name?
Simply type the following command:# fdisk -l /dev/sda
# fdisk -l /dev/sdb
How Do I Mount /dev/sda1 NTFS Partition at /mnt/ntfs?
First, load the fuse driver, enter:# modprobe fuse
Create a mount point, enter:# mkdir /mnt/ntfs
To mount the ntfs partition, enter:# mount -t ntfs-3g /dev/sda1 /mnt/ntfs
You can use regular Unix commands to copy or access the files:$ df -h
$ mount
$ cd /mnt/ntfs
$ cp foo /tmp
How Do I Unmount NTFS Partition?
Type the following command:# umount /mnt/ntfs
Migrating PostgreSQL files to new server
Migrating PostgreSQL files to new server
Install the latest minor release of the same PostgreSQL major version - e.g. if you were using 9.4.1 before, install 9.4.26. Make sure it's the same architecture - i.e. if you were using a 32-bit PostgreSQL before you must install 32-bit PostgreSQL now.
- Stop the service (postgresql) using the services control panel (
services.msc
). - Path in services - "C:\Program Files\PostgreSQL\9\bin\pg_ctl.exe" runservice -N "postgresql-x64-9" -D "D:\PostgreSQL\9\data" -w do not
- Modify the configuration to the following with the
sc
command: sc config postgresql-x64-9.4 binPath= "\"C:\Program Files\PostgreSQL\9.4\bin\pg_ctl.exe\" runservice -N \"postgresql-x64-9.4\" -D \"E:\pg_db\data\" -w" - Delete
%PROGRAMFILES%\PostgreSQL\9.4\data
. - Copy the old
data
directory to that location - copyC:\Program Files\PostgreSQL\9.4\data\
toE:\pg_db\data
- Get properties on the
data
directory and in the security tab recursively grant full control toNETWORKSERVICE or pgsql - - bad permissions will prevent the database from starting
- Start the service using
services.msc
- immediately set up backups.
How to Unzip zip files in CentOS using unzip Command
How to Unzip zip files in CentOS using unzip Command
Install unzip command on CentOS 7
#yum install unzip
Unzip zip files in command line in CentOS
To unzip a zip folder, use the unzip command followed by the name of the zip file.
unzip file_for_unzip.zip
The unzip command in CentOS will unzip the zip file to the current working directory.
Unzip zip file to specific directory
With -d
option we can specify the directory, which we want to extract files.
unzip -d /home/user/Documents file
_for_unzip
.zip
This time CentOS unzip command will extract the zip file to the /home/user/Documents directory.