Friday, April 7, 2017

RHEL7 - Initial Server set up


Summary

1. Add host entry to hosts file.
# vi /etc/hosts
2. Mount your ISO image and copy it locally
# mount -t iso9660 -o loop /home/kbhusal/rhel-server-7.3-x86_64-dvd.iso /mnt
# df -h /mnt
# cd /mnt
# mkdir /opt/OS_Image
# cp -a * /opt/OS_Image/
3. Create required user to the system if its local.
# useradd -c "John Smith" jsmith
# passwd jsmith
4. Grant user admin access to the system.
# visudo
5. Set up local repo
# cd /etc/yum.repos.d/
#  vi local.repo
# yum clean all
# yum repolist
# yum search httpd
# rpm -qa | grep httpd
# yum install httpd

Detail


1. Once you login to newly installed system, add host entry to hosts file.
[root@sgld-lx-v01 ~]# vi /etc/hosts
192.168.10.120    sgld-lx-v01.expanor.local    sgld-lx-v01

2. Create yum repo [ Mount your ISO image and copy it locally ]
[root@sgld-lx-v01 ~]# mount -t iso9660 -o loop /home/kbhusal/rhel-server-7.3-x86_64-dvd.iso /mnt
mount: /dev/loop0 is write-protected, mounting read-only
[root@sgld-lx-v01 ~]# df -h /mnt
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0      3.6G  3.6G     0 100% /mnt
[root@sgld-lx-v01 mnt]# mkdir /opt/OS_Image
[root@sgld-lx-v01 mnt]# cp -a * /opt/OS_Image/

3. Create required user to the system if its local.
[root@sgld-lx-v01 mnt]# useradd -c "Pradip Giri" pradip
[root@sgld-lx-v01 mnt]# passwd pradip
Changing password for user pradip.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

4. Grant user admin access to the system.
[root@sgld-lx-v01 mnt]# visudo
User_Alias ADMINS = sam, pradip
ADMINS  ALL=(ALL)       NOPASSWD: ALL

5. Set up local repo
[root@sgld-lx-v01 yum.repos.d]# vi local.repo
[root@sgld-lx-v01 yum.repos.d]# cat local.repo
[LOCAL]
name = Local Redhat Repo
baseurl = file:///opt/OS_Image
enabled = 1
gpgcheck = 0
[root@sgld-lx-v01 yum.repos.d]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: LOCAL
Cleaning up everything
[root@sgld-lx-v01 yum.repos.d]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
LOCAL                            | 4.1 kB  00:00:00
(1/2): LOCAL/group_gz            | 136 kB  00:00:00
(2/2): LOCAL/primary_db          | 3.9 MB  00:00:00
repo id                      repo name             status
LOCAL                        Local Redhat Repo    4,751
repolist: 4,751
[root@sgld-lx-v01 yum.repos.d]# yum search httpd
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
============================================== N/S matched: httpd ===============================================
httpd.x86_64 : Apache HTTP Server
httpd-devel.x86_64 : Development interfaces for the Apache HTTP server
httpd-manual.noarch : Documentation for the Apache HTTP server
httpd-tools.x86_64 : Tools for use with the Apache HTTP Server
libmicrohttpd.i686 : Lightweight library for embedding a webserver in applications
libmicrohttpd.x86_64 : Lightweight library for embedding a webserver in applications
mod_auth_mellon.x86_64 : A SAML 2.0 authentication module for the Apache Httpd Server
mod_dav_svn.x86_64 : Apache httpd module for Subversion server

  Name and summary matches only, use "search all" for everything.
[root@sgld-lx-v01 yum.repos.d]# yum install httpd
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-45.el7 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-45.el7 for package: httpd-2.4.6-45.el7.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-45.el7.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-45.el7.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-45.el7.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-45.el7 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================
 Package                      Arch                    Version                       Repository              Size
=================================================================================================================
Installing:
 httpd                        x86_64                  2.4.6-45.el7                  LOCAL                  1.2 M
Installing for dependencies:
 apr                          x86_64                  1.4.8-3.el7                   LOCAL                  103 k
 apr-util                     x86_64                  1.5.2-6.el7                   LOCAL                   92 k
 httpd-tools                  x86_64                  2.4.6-45.el7                  LOCAL                   84 k
 mailcap                      noarch                  2.1.41-2.el7                  LOCAL                   31 k

Transaction Summary
=================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 1.5 M
Installed size: 4.3 M
Is this ok [y/d/N]: n
Exiting on user command
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx.2017-04-05.15-16.l571TA.yumtx
[root@sgld-lx-v01 yum.repos.d]#


This completes the set up on yum repo on RHEL7.

No comments:

Post a Comment