Error when trying to create tar.bz2 Archive File in CentOS 7
The following is the error output when trying to create tar.bz2 file in CentOS7:
$ tar cvfj testfile.tar.bz2 ./testfile*
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
$
First step is to check if the package is installed or not.
$ sudo yum list installed | grep bzip2
If package is not installed, please run the following:
# yum install bzip2
# exit
Then create tar.bz2 file.
$ tar cvfj testfile.tar.bz2 ./testfile*
Thursday, December 29, 2016
Wednesday, December 28, 2016
Issue: CentOS 7 network not in VirtualBox
Issue: Fresh installed CentOS 7 network interface not working.
[root@localhost slean]# ip addr
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:c8:da:c2 brd ff:ff:ff:ff:ff:ff
[root@localhost slean]#
As you can see the interface doesn't have IP address.
To fix this issue, first edit the network interface. nmtui is a network manager tool user interface.
[root@localhost slean]# nmtui
[root@localhost slean]# ip addr
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:c8:da:c2 brd ff:ff:ff:ff:ff:ff
[root@localhost slean]#
As you can see the interface doesn't have IP address.
To fix this issue, first edit the network interface. nmtui is a network manager tool user interface.
[root@localhost slean]# nmtui
Select the interface and click "Edit".
Enable the DHCP by setting the Automatically connect and make sure the IPv4 CONFIGURATION to <Automatic>.
Click <OK> and <Quit>.
[root@localhost slean]# system restart network
[root@localhost slean]# ip addr
Source: krizna.com
Monday, December 19, 2016
Commands to check CentOS version
These are the commands on CentOS to check version:
# hostnamectl
# rpm --query centos-release
# cat /etc/centos-release
# cat /etc/os-release
# cat /etc/redhat-release
# cat /etc/system-release
Note:
# uname -a
and
# uname -r
will not give the OS version in detail.
[root@localhost slean]# hostnamectl
Static hostname: localhost.localdomain
Icon name: computer
Chassis: n/a
Machine ID: e6450196561343d9976ba0d9c29c54c0
Boot ID: 0ddca677a08a44019c0f9b71fec2882a
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-229.11.1.el7.x86_64
Architecture: x86_64
[root@localhost slean]#
Similar result from running # hostnamectl on Oracle VirtualBox
Source: https://linuxconfig.org/how-to-check-centos-version
# hostnamectl
# rpm --query centos-release
# cat /etc/centos-release
# cat /etc/os-release
# cat /etc/redhat-release
# cat /etc/system-release
Note:
# uname -a
and
# uname -r
will not give the OS version in detail.
[root@localhost slean]# hostnamectl
Static hostname: localhost.localdomain
Icon name: computer
Chassis: n/a
Machine ID: e6450196561343d9976ba0d9c29c54c0
Boot ID: 0ddca677a08a44019c0f9b71fec2882a
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-229.11.1.el7.x86_64
Architecture: x86_64
[root@localhost slean]#
Similar result from running # hostnamectl on Oracle VirtualBox
[root@localhost ~]# hostnamectl
Static hostname: localhost.localdomain
Icon name: computer-vm
Chassis: vm
Machine ID: ec0ea531f8894f84b9d5266ee38dfd8a
Boot ID: d1fa0335dab445fca139710b318734a8
Virtualization: oracle
Operating System: CentOS Linux 8 (Core)
CPE OS Name: cpe:/o:centos:centos:8
Kernel: Linux 4.18.0-193.14.2.el8_2.x86_64
Architecture: x86-64
[root@localhost ~]#
Another way to get the CentOS version is by
[slean@localhost ~]$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[slean@localhost ~]$
The next 3 commands give the same output result
[slean@localhost ~]$ cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core)
[slean@localhost ~]$
[slean@localhost ~]$ cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
[slean@localhost ~]$
[slean@localhost ~]$ cat /etc/system-release
CentOS Linux release 7.1.1503 (Core)
[slean@localhost ~]$
Source: https://linuxconfig.org/how-to-check-centos-version
Monday, May 30, 2016
Python Notes
To find out where Python is installed in your Linux machine run the following commands:
~$ which python
/usr/bin/python
~$ which python3
/usr/bin/python3
To find out what Python version is running in your Linux box, run the following commands:
~$ python -V
Python 2.7.6
~$ python3 -V
Python 3.4.3
To start programing Python, run the following command:
~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
~$ which python
/usr/bin/python
~$ which python3
/usr/bin/python3
To find out what Python version is running in your Linux box, run the following commands:
~$ python -V
Python 2.7.6
~$ python3 -V
Python 3.4.3
To start programing Python, run the following command:
~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Use exit() or Ctrl-D (i.e. EOF) to exit
>>>
To exit type the following
>>> exit()
~$
~$ python3
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
~$
Subscribe to:
Posts (Atom)