Linux File System Hierarchy

The file system hierarchy

All files on a Linux system are stored on file systems which are organized into a single inverted tree of directories, know as a file system hierarchy.In the inverted tree, root lies at the top and the branches of directories and sub-directories stretch below the root.

linux-filesystem.png

Figure: Significant file system directories (RHEL 7)

Here, the directories ‘/’ is the root directory which lies at the top of file system hierarchy. The ‘/’ character is also used as a directory separator in the file name, for example ‘/etc’ is a sub-directory of ‘/’ directory.

Important RHEL (Red Hat Enterprise Linux) directories

Location Purpose
/usr

Installed software, shared libraries, include files, and static read-only program data. Important subdirectories include:-

* /usr/bin: User commands.

* /usr/sbin: System administration commands.

* /usr/local: Locally customized software.

/etc Configuration files specific to this system.
/var Files that dynamically change (e.g. databases, cache directories, log files, printer spooled documents, and website content) may be found under /var.
/run Run-time data for processes started since the last boot. This includes process ID files and lock files, among other things. The contents of this directory are recreated on reboot.
/home Home directories where regular users store their personal data and configuration files.
/root Home directory for the administrative superuser, root.
/tmp A world-writable space for temporary files. Files more than 10 days are automatically be deleted from that directory. Another temporary directory exists at /var/tmp, in which files that have not been accessed,changed, or modified in more than 30 days are deleted automatically.
/boot Files needed in order to start the boot process.
/dev Contains special device files which are used by the system to access hardware.

Important

In RHEL Linux 7, Four oulder directories in ‘/’ now have identical contents as their counterparts located in /usr:

– /bin and /usr/bin

– /sbin and /usr/sbin

– /lib and /usr/lib

– /lib64 and /usr/lib64

In older versions of RHEL, these were distinct directories containing different sets of files. In RHEL 7, the directories in ‘/’ are symbolic links to the matching directories in /usr.

Thank you.

For more reading materials please click here !!!

Advertisements
Linux File System Hierarchy

Reset a forgotten ROOT password

For CentOS 6

Option A

1. Boot Computer & Interrupt (Press space).

2. Type ‘a’ for kernel argument.

3. Append 1 at the end of “rhgbquiet” and press ‘Enter’ key to boot in Single mode.

4. Type “runlevel” to know runlevel.

5. Type “passwd” and change the password.

Option B

1. Bootsystem and list avaiable kernel version. (Press any key to enter the menu)

2. Press ‘e’.

3. Highlight the list item with vmlinuz & press ‘e’.

4. Type single or init 1 at end of the line.

5. Press enter and ‘b’ to boot with new argument.

6. Type password.

For CentOS 7

1. Reboot your system, and interrupt the countdown in the boot loader menu.

a. Send a Ctrl+Alt+Del to your system using the relevant button or menu entry.

b. When the boot loader menu appers, press any key to interrupt the countdown.

2. Edit the default boot loader entry (in memory) to abort the boot process just after all file systems have been mounted, but before control is handed over to systemd, then boot.

a. Use the cursor keys to highlight the default boot loader entry.

b. Press ‘e’ to edit the current entry.

c. Using the cursor keys, navigate to the line that starts with linux16.

d. Press End to move the cursor to the end of the line.

e. Append rd.break to the end of the line.

f. Press Ctrl +x to boot using the modified config.

3. At the switch_root prompt, remount the /sysroot file systemd read-write, then use chroot to go into a chroot jail at /sysroot.

switch_root:/# mount -oremount,rw /sysroot
switch_root:/# chroot /sysroot

4. Change the root password as you desire.

sh-4.2# echo redhat | passwd --stdin root

5. Configure the system to automatically perform a full SELinux relabel after boot. This is necessary since the passwd tool re-created the /etc/shadow file without an SELinux context.

sh-4.2# touch /.autorelabel

6. Type exit twice to continue booting your system as normal. The system will run an SELinux relabel, then reboot again by itself.

Thank you.

For more reading materials please click here !!!

Reset a forgotten ROOT password

Install & Configure FTP server on centos 7 (VSFTP)

FTP server is used to exchange files between computers over network . This guide helps you to setup ftp server on centos 7 . This guide contains configuration steps for both FTP and SFTP as well as user creation . Here  we have used VSFTP package which is secure and less vulnerable .

Setup FTP server on centos 7

Step 1 » Update your repository and install VSFTPD package .

[nepalisupport@blog~]# yum update -y  (update your installed packages)

[nepalisupport@blog~]# yum install -y vsftpd

Step 2 » After installation you can find /etc/vsftpd/vsftpd.conf file which is the main configuration file for VSFTP.
Take a backup copy before making changes.

[nepalisupport@blog~]# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf_bak

Now open the file and make changes as below;

[nepalisupport@blog~]# vim /etc/vsftpd/vsftpd.conf

and edit following lines,

1. Find this line anonymous_enable=YES ( Line no : 12 ) and change value to NO to disable anonymous FTP access.

anonymous_enable=NO

2. Allow local uses to login by changing local-enable

local_enable=YES

3. If you want local user to write to directory,

write_enable=YES

4. Local users will be çhroot jailed’& Denined

chroot_local_user=YES

and add the below lines at the end of the file to enable passive mode and allow chroot writable.

allow_writeable_chroot=YES
pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=40100

Then save and exit.

Now restart and enable vsftpd services.

[nepalisupport@blog~]# systemctl restart vsftpd

[nepalisupport@blog~]# systemctl enable vsftpd

As per your system security, you can configure firewall or disable it. To fix through firewall:-

[nepalisupport@blog~]# firewall-cmd --permanent --add-port=21/tcp

[nepalisupport@blog~]# firewall-cmd --reload

That’s it, you have successfully install vsftpd on your machine.

By default your vsftpd data are stored in /home, so you can

If you cannot log in or access or get any error, then try changing chroot_local_user setting in vsftpd.conf file as,

chroot_local_user= NO

If you encounter any problem, please be free to contact us.

Thank you.

For more reading materials please click here !!!

Install & Configure FTP server on centos 7 (VSFTP)

Install PHP 7 in CentOS machine

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. PHP code may be embedded into HTML code, or it can be used in combination with various web template systems, web content management systems and web frameworks.

PHP 7.0.7 has been released on PHP.net on 26th May 2016, and is also available for CentOS/RHEL 6.8 and 7.2 at Webtatic via Yum in it’s testing repository. PHP 7.0.0 comes with new version of the Zend Engine with features such as (incomplete list):

  • Improved performance: PHP 7 is up to twice as fast as PHP 5.6
  • Consistent 64-bit support
  • Many fatal errors are now Exceptions
  • Removal of old and unsupported SAPIs and extensions
  • The null coalescing operator (??)
  • Combined comparison Operator (<=>)
  • Return Type Declarations
  • Scalar Type Declarations
  • Anonymous Classes

 

For CentOS 7,

[nepalisupport@blog~]# rpm -Uvh https://dl.fedoraprojects.org/pub/epel/epel-release-latest-7.noarch.rpm

[nepalisupport@blog~]# rpm -Uvh https://mirror.webtatic.com/yum/el/webtatic-release.rpm

For CentOS 6,

[nepalisupport@blog~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

[nepalisupport@blog~]# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

Now you can install PHP 7.0’s (along with an opcode cache) by doing:

[nepalisupport@blog~]# yum install php70w php70w-opcache

Other Packages

You can download and install other PHP 7 related packages:-

Packages
Package Provides
php70w mod_php, php70w-zts
php70w-bcmath
php70w-cli php-cgi, php-pcntl, php-readline
php70w-common php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
php70w-dba
php70w-devel
php70w-embedded php-embedded-devel
php70w-enchant
php70w-fpm
php70w-gd
php70w-imap
php70w-interbase php_database, php-firebird
php70w-intl
php70w-ldap
php70w-mbstring
php70w-mcrypt
php70w-mysql php-mysqli, php_database
php70w-mysqlnd php-mysqli, php_database
php70w-odbc php-pdo_odbc, php_database
php70w-opcache php70w-pecl-zendopcache
php70w-pdo
php70w-pdo_dblib php70w-mssql
php70w-pear
php70w-pecl-apcu
php70w-pecl-imagick
php70w-pecl-xdebug
php70w-pgsql php-pdo_pgsql, php_database
php70w-phpdbg
php70w-process php-posix, php-sysvmsg, php-sysvsem, php-sysvshm
php70w-pspell
php70w-recode
php70w-snmp
php70w-soap
php70w-tidy
php70w-xml php-dom, php-domxml, php-wddx, php-xsl
php70w-xmlrpc  
Install PHP 7 in CentOS machine

Making Gitlab-Server on CentOS 7

GitLab, the software, is a web-based Git repository manager with wiki and issue tracking features. GitLab, the company, offers hosted accounts similar to GitHub, but also allows its software to be used on third-party servers. It is available as an Omnibus package.(Compared to an installation from source, this is faster and less error prone)

Install a Gitlab CE Omnibus package on CentOS 7. Use the following steps:-

1. Install and configure the necessary dependencies.

[nepalisupport@blog~]# yum install curl policycoreutils openssh-server openssh-clients

[nepalisupport@blog~]# systemctl enable sshd

[nepalisupport@blog~]# systemctl start sshd

[nepalisupport@blog~]# yum install postfix

[nepalisupport@blog~]# systemctl enable postfix

[nepalisupport@blog~]# systemctl start postfix

[nepalisupport@blog~]# firewall-cmd --permanent --add-service=http

[nepalisupport@blog~]# systemctl reload firewalld

2. Add the Gitlab package server and install packages,

[nepalisupport@blog~]# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh /sudo bash

[nepalisupport@blog~]# yum install gitlab-ce

3. Configure and start Gitlab

[nepalisupport@blog~]# gitlab-ctl reconfigure

4. Now, Browse to the hostname & login,

Eg: 192.168.3.25/gitlab on your browser;

user: root || password: g!tl@b              (you can assign your own password)

You can access a new installation with the login root and password 5iveL!fe, after login you are required to set a unique password.

That’s it. You have sucessfully configure gitlab-ce on your CentOS 7 machine.

~END~

Other useful commands,

[nepalisupport@blog~]# gitlab-ctl start

[nepalisupport@blog~]# gitlab-ctl stop

[nepalisupport@blog~]# gitlab-ctl restart

 

Troubleshooting

If you encounter “502 error” on your web page, then enter following commands,

[nepalisupport@blog~]# gitlab restart sidekig

[nepalisupport@blog~]# gitlab-ctl hup unicorn

[nepalisupport@blog~]# gitlab-rake gitlab:check

 

This tutorial is created based on other technical blog and is fully tested on Centos 7. Feel free to comment, Thank You.

For more reading materials please click here

Making Gitlab-Server on CentOS 7

How to Enable Loopback Adapter in Windows 10

The loopback adapter is quite a useful tool that was designed for testing out the network configurations. Over many years, some resourceful geeks and administrators have founded that the Loopback adapter has some handy features as well like connecting two computers without a crossover cable or connecting a virtual machine to the Internet. Though the Loopback Adapter has a strong background, yet Microsoft seems to be hiding this feature in every new release of Windows. Before we continue to learn how to enable this feature, let me tell you why you need it.

Why You Need Loopback Adapter?

The Loopback adapter is used as a testing tool for virtual network environment when the network access isn’t available. Moreover, you also need to use it with network adapter or a network adapter driver. This feature also allows you to bind network configuration items, protocols and network clients. If we some up the overall use of Loopback adapter, then I would say that is a multi-purpose features used for managing IPs, BGP Peer Address, router ID interfaces, etc. I hope that now you have a better idea of Loopback adapter, so let’s continue to learn to enable this feature.

Enable Loopback Adapter

1. In the search bar, right next to the Windows icon, type “Device Manager”. From the displayed results, tap on the “Device Manager”.

2. From the device manager window, click on action, and then from the drop down box, click on “Add legacy hardware”.

3. From the “Add Hardware” window, click on “Install the hardware that I manually select from a list (Advanced)” and after that click Next.

4. Now choose “Network adapters” and click Next.

5. Navigate “Microsoft” from the left pane under the manufacturer section. Next choose Microsoft KM-TEST Loopback adapter, and click Next until it’s finished.

6. Congratulations! You have now successfully enabled the loopback adapter.

 

This tutorial is created based on other technical blog. Feel free to comment, Thank You.

For more reading materials please click here

How to Enable Loopback Adapter in Windows 10