How To Configure Yum Server In REDHAT6
1. YellowDog Updater Modified (YUM)
2. Mount the rhel-6 dvd
mount /dev/cdrom /mnt
GOTO
3. cd /mnt/Packages
NOW INSTALL
4. rpm -ivh vsftpd[TAB CLICK]
5. service vsftpd start
6. chkconfig vsftpd on
7. mkdir /var/ftp/pub/rhelrepo
8. cp -av /mnt/Packages/* /var/ftp/pub/rhelrepo
9. cp /mnt/repodata/*comps*.xml /var/ftp/pub/rhelrepo/comps.xml[optional] [
Need to create group repository]
GOTO
10. cd /var/ftp/pub/rhelrepo
11. rpm -ivh deltarpm [TAB CLICK]
12. rpm -ivh python-deltarpm [TAB CLICK]
13. rpm -ivh createrepo [TAB CLICK]
14. createrepo -g /var/ftp/pub/rhelrepo/comps.xml /var/ftp/pub/rhelrepo
CREATE A FILE
15. vim /etc/yum.repos.d/server.repo
[server]
name=server repo
baseurl=file:///var/ftp/pub/rhelrepo/
gpgcheck=0
enabled=1
:wq
NOW
MAKE SURE
16. yum clean all [if you have local.repo then delete it first]
17. yum makecache
18. To check if the server is up and functioning
yum info squid
yum groupinfo "KDE
Desktop"
19. chcon -R -t public_content_t /var/ftp/pub/rhelrepo
20. service vsftpd restart
Client Configuration
1. mount /dev/cdrom /mnt
2. cd /mnt/Packages/
3. rpm -ivh ftp[TAB]
4. vim /etc/yum.repos.d/yum.repo
[server]
name=server repo
baseurl=ftp://192.168.122.43/pub/rhelrepo/
[assuming that the server ip is 192.168.122.43]
gpgcheck00
enabled=1
:wq
5. yum clean all [if you have local.repo then delete it first]
6. yum makecache
Troubleshooting
===============
7. If you see any error saying "couldn't connect to host"
then enable port 21 in the yum server
iptables -I INPUT -p tcp --dport
21 -j ACCEPTservice
service iptables save
service iptables restart
8. You should also enable the port 20
iptables -I INPUT -p tcp --dport
20 -j ACCEPT
9. If you can login successfully with the anonymous
user but cannot list (ls command) the ftp or pub directory and "no route
to host or entering passive mode is displayed" then
#### remove the 2 lines from
/etc/sysconfig/iptables
-A
FORWARD -j REJECT --reject-with icmp-host-prohibited
REDHAT6 -USE THIS COMMAND TO MAKE A YUM SERVER
IF YOU HAVE ANY QUESTION PLZ CONTACT US
How To Configure Yum Server In REDHAT6
1. YellowDog Updater Modified (YUM)
2. Mount the rhel-6 dvd
mount /dev/cdrom /mnt
mount /dev/cdrom /mnt
3. cd /mnt/Packages
4. rpm -ivh vsftpd[TAB CLICK]
7. mkdir /var/ftp/pub/rhelrepo
10. cd /var/ftp/pub/rhelrepo
11. rpm -ivh deltarpm [TAB CLICK]
12. rpm -ivh python-deltarpm [TAB CLICK]
13. rpm -ivh createrepo [TAB CLICK]
14. createrepo -g /var/ftp/pub/rhelrepo/comps.xml /var/ftp/pub/rhelrepo
15. vim /etc/yum.repos.d/server.repo
[server]
name=server repo
baseurl=file:///var/ftp/pub/rhelrepo/
gpgcheck=0
enabled=1
:wq
16. yum clean all [if you have local.repo then delete it first]
17. yum makecache
18. To check if the server is up and functioning
yum info squid
yum groupinfo "KDE Desktop"
19. chcon -R -t public_content_t /var/ftp/pub/rhelrepo
20. service vsftpd restart
Client Configuration
1. mount /dev/cdrom /mnt
2. cd /mnt/Packages/
3. rpm -ivh ftp[TAB]
4. vim /etc/yum.repos.d/yum.repo
[server]
name=server repo
baseurl=ftp://192.168.122.43/pub/rhelrepo/ [assuming that the server ip is 192.168.122.43]
gpgcheck00
enabled=1
:wq
5. yum clean all [if you have local.repo then delete it first]
6. yum makecache
===============
7. If you see any error saying "couldn't connect to host"
then enable port 21 in the yum server
iptables -I INPUT -p tcp --dport 21 -j ACCEPTservice
service iptables save
service iptables restart
8. You should also enable the port 20
iptables -I INPUT -p tcp --dport 20 -j ACCEPT
#### remove the 2 lines from /etc/sysconfig/iptables
AUTOMOUNT
=========
Package name: autofs
What is Autofs---Autofs is a client-side service that automatically mounts the appropriate file system. The components that work together to accomplish automatic mounting are the following thats not parmanent mount when need its auto mount automatic
1. Sometimes you might want to mount a share (nfs or smb) permanently.
You can do it by adding the share details in the fstab file.
The problem is, if the target computer is not running then your computer would freeze at boot time. The reason is, your computer will try to mount all the filesystems mentioned in the fstab. Since the target computer is not running, your computer would fail to mount the nfs or smb share.
2. To avoid this situation, we configure automount to mount the shares.
3. Two files are needed to configure automount
i. auto.master
ii. auto.misc
both files reside in the /etc directory
4. Let's assume we have a share on a server named server-1
The servers ip is 192.168.1.1
The share path is /share1
5. We have a client machine named client-1
The clients ip is 192.168.1.2
We will mount the share in the /ok directory
6. We need to permanently mount the /share1 on client-1
7. First open the auto.master file
vim /etc/auto.master
/ok /etc/auto.misc
:wq
8. vim /etc/auto.misc
share1 -fstype=nfs 192.168.1.1:/share1
:wq
9. service autofs restart
10. ls /ok/share1
11. you should see the shared files.
=========
Package name: autofs
What is Autofs---Autofs is a client-side service that automatically mounts the appropriate file system. The components that work together to accomplish automatic mounting are the following thats not parmanent mount when need its auto mount automatic
1. Sometimes you might want to mount a share (nfs or smb) permanently.
You can do it by adding the share details in the fstab file.
The problem is, if the target computer is not running then your computer would freeze at boot time. The reason is, your computer will try to mount all the filesystems mentioned in the fstab. Since the target computer is not running, your computer would fail to mount the nfs or smb share.
2. To avoid this situation, we configure automount to mount the shares.
3. Two files are needed to configure automount
i. auto.master
ii. auto.misc
both files reside in the /etc directory
4. Let's assume we have a share on a server named server-1
The servers ip is 192.168.1.1
The share path is /share1
5. We have a client machine named client-1
The clients ip is 192.168.1.2
We will mount the share in the /ok directory
6. We need to permanently mount the /share1 on client-1
7. First open the auto.master file
vim /etc/auto.master
/ok /etc/auto.misc
:wq
8. vim /etc/auto.misc
share1 -fstype=nfs 192.168.1.1:/share1
:wq
9. service autofs restart
10. ls /ok/share1
11. you should see the shared files.
Samba Just Magic
what is SAMBA
As the front page at samba.org says, "Samba is an Open Source/Free Software suite that provides seamless file and print services toSMB/CIFS clients." Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unixservers and Windows-based clients.
=====
Section-1:
Configuring smb client:
1. You don't need to configure any client to use smb.
2. smb-client package is installed by default.
3. To view the shares of a machine type
smbclient -L ip-or-hostname -U username
Example: smbclient -L 192.168.100.254 -U student
4. To mount a samba share
mount.cifs //target/sharename /mounting_directory -o user=username
Example: mount.cifs //192.168.100.254/share /mountsmb -o user=student
[assuming that the target server is 192.168.100.254, the sharename is share, the mounting directory is /mountsmb and the user is student]
enter the password for the user student
ls /mountsmb
you should see the contents of the share in the /mountsmb directory.
Section-2: SAMBA Server
Configuring samba share:
1. Package name = samba4
2. yum install samba4*
if you get any error
yum erase samba*
then again yum install samba4*
[ if you cannot erase samba then type yum install samba-*]
3. Configure firewall to allow smb traffic
iptables -I INPUT -p tcp --dport 137 -j ACCEPT
iptables -I INPUT -p udp --dport 137 -j ACCEPT
iptables -I INPUT -p tcp --dport 138 -j ACCEPT
iptables -I INPUT -p udp --dport 138 -j ACCEPT
iptables -I INPUT -p tcp --dport 445 -j ACCEPT
iptables -I INPUT -p udp --dport 445 -j ACCEPT
iptables -I INPUT -p tcp --dport 139 -j ACCEPT
iptables -I INPUT -p udp --dport 139 -j ACCEPT
4. service iptables save
5. service iptables restart
6. create directories which you want to share or use existing directory
here we are creating a directory
mkdir /newshare
cd /newshare
touch file1 file2 file3
7. create a user to access smb share or use existing user
here we are creating a new user
useradd smbuser
passwd smbuser
smbpasswd -a smbuser [ if you use existing user then only this command would be enough]
8. vim /etc/samba/smb.conf
#find the line starts with "workgroup=mygroup"
change the mygroup to WORKGROUP
#fine the line starts with "host allow="
remove the semicolon (;) and modify the line to add the networks you want to give access to
#Now go to the last line of the file and insert a new line
[sharename]
comment = any comment
path = /path-of-the-share-directory
browseable = yes
writable = yes
printable = yes
valid users = username
### and many more options which you have to learn on you own interest###
9. For every share you have to cofigure this file again and again
10. service smb start
11. chkconfig smb on
12. service nmb start
13. chkconfig nmb on
14. service winbind start
15. chkconfig winbind on
16. To check the share
smbclient -L ip -U username
type the password of the user and you should see the shares.
17. Now go to another machine and follow section-1
what is SAMBA
As the front page at samba.org says, "Samba is an Open Source/Free Software suite that provides seamless file and print services toSMB/CIFS clients." Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unixservers and Windows-based clients.
=====
Section-1:
Configuring smb client:
1. You don't need to configure any client to use smb.
2. smb-client package is installed by default.
3. To view the shares of a machine type
smbclient -L ip-or-hostname -U username
Example: smbclient -L 192.168.100.254 -U student
4. To mount a samba share
mount.cifs //target/sharename /mounting_directory -o user=username
Example: mount.cifs //192.168.100.254/share /mountsmb -o user=student
[assuming that the target server is 192.168.100.254, the sharename is share, the mounting directory is /mountsmb and the user is student]
enter the password for the user student
ls /mountsmb
you should see the contents of the share in the /mountsmb directory.
Section-2: SAMBA Server
Configuring samba share:
1. Package name = samba4
2. yum install samba4*
if you get any error
yum erase samba*
then again yum install samba4*
[ if you cannot erase samba then type yum install samba-*]
3. Configure firewall to allow smb traffic
iptables -I INPUT -p tcp --dport 137 -j ACCEPT
iptables -I INPUT -p udp --dport 137 -j ACCEPT
iptables -I INPUT -p tcp --dport 138 -j ACCEPT
iptables -I INPUT -p udp --dport 138 -j ACCEPT
iptables -I INPUT -p tcp --dport 445 -j ACCEPT
iptables -I INPUT -p udp --dport 445 -j ACCEPT
iptables -I INPUT -p tcp --dport 139 -j ACCEPT
iptables -I INPUT -p udp --dport 139 -j ACCEPT
4. service iptables save
5. service iptables restart
6. create directories which you want to share or use existing directory
here we are creating a directory
mkdir /newshare
cd /newshare
touch file1 file2 file3
7. create a user to access smb share or use existing user
here we are creating a new user
useradd smbuser
passwd smbuser
smbpasswd -a smbuser [ if you use existing user then only this command would be enough]
8. vim /etc/samba/smb.conf
#find the line starts with "workgroup=mygroup"
change the mygroup to WORKGROUP
#fine the line starts with "host allow="
remove the semicolon (;) and modify the line to add the networks you want to give access to
#Now go to the last line of the file and insert a new line
[sharename]
comment = any comment
path = /path-of-the-share-directory
browseable = yes
writable = yes
printable = yes
valid users = username
### and many more options which you have to learn on you own interest###
9. For every share you have to cofigure this file again and again
10. service smb start
11. chkconfig smb on
12. service nmb start
13. chkconfig nmb on
14. service winbind start
15. chkconfig winbind on
16. To check the share
smbclient -L ip -U username
type the password of the user and you should see the shares.
17. Now go to another machine and follow section-1
about LVM
what is lvm:----Lvm mean
logical volume manager
u Logical Volume Manager (LVM) is a
device mapper target that provides a more flexible way to manage disk space
than physical disk partition
Why we use lvm
u Some of your partition filled up
you want to expand it
u You want to shirnk your partition
u Add one or more disk/device
u You want to take backup of your
file system/partition while you are still using it
lvm configuration------------------
create lvm---
1. Let's assume we have three new hard drives /dev/sda, /dev/sdb, /dev/sdc
2. First we need to create the physical volumes
pvcreate /dev/sda /dev/sdb [ /dev/sdc is left to extend the physical volume later]
pvdisplay
3. Now we need to create the logical volume group
vgcreate name-of-the-group /dev/sda /dev/sdb
Example: vgcreate vg1 /dev/sda /dev/sdb
vgdisplay
4. lvcreate -n lv1 -L 1G vg1
lvdisplay
5. mkfs.ext4 /dev/vg1/lv1
6. mkdir /lvolume1 [to mount the logical volume lv1 create a directory]
7. vim /etc/fstab
/dev/vg1/lv1 /lvolume1 ext4 defaults 0 0
or /dev/mapper/vg1-lv1 /lvolume1 ext4 defaults 0 0
8. mount -a
9. reboot
Extend LVM
==========
Situations of extending LVM
a. The logical volume is out of space => Extend the logical volume.
b. The logical volume and the volume group both are out of space => Extend the volume group by adding new physical volume.
1. To extend volume group
i. Add a new hard drive or create a new partition
ii. pvcreate /dev/sdc [ assuming your new drive is sdc]
iii. pvscan or pvdisplay [ optional]
iv. vgextend volume-group-name /dev/sdc
Example: vgextend vg1 /dev/sdc [ assuming your volume group is vg1 and partition is sdc]
v. vgscan
2. To extend logical volume [ umount /lvolume1 (assuming that you have mounted the logical volume at /lvolume1)]
i. lvextend -L +1G /dev/vg1/lv1
ii. resize2fs -p /dev/vg1/lv1
iii. mount -a
https://www.youtube.com/watch?v=1StGzqQcEEo
SSH - Secure Shell
SSH - Secure Shell
------------------------
Port no: 22 (default)
Package: openssh-server
Daemon: sshd
configuration file: /etc/ssh/sshd_config
Port no: 22 (default)
Package: openssh-server
Daemon: sshd
configuration file: /etc/ssh/sshd_config
Step by step configuration:
==========================
==========================
Step 01: RPM Query, install
---------------------------------
[root@serverX ~]# rpm -qa | grep openssh-server
openssh-server-6.4p1-8.el7.x86_64
---------------------------------
[root@serverX ~]# rpm -qa | grep openssh-server
openssh-server-6.4p1-8.el7.x86_64
[root@serverX ~]# yum install openssh* -y [if not found]
[root@serverX ~]# systemctl restart sshd.service
[root@serverX ~]# systemctl enable sshd.service
[root@serverX ~]# systemctl enable sshd.service
[root@serverX ~]# systemctl stop firewalld.service
[root@serverX ~]# systemctl disable firewalld.service
[root@serverX ~]# setenforce 0 ;SELinux off
[root@serverX ~]# systemctl disable firewalld.service
[root@serverX ~]# setenforce 0 ;SELinux off
SSH Client:
-----------
=> Linux Client (defautl installed)
=> Windows Client (putty, ssh client)
> putty > ssh > ip > port (22)
-----------
=> Linux Client (defautl installed)
=> Windows Client (putty, ssh client)
> putty > ssh > ip > port (22)
Testing:
--------
> ping 192.168.11.Y (ssh server)
--------
> ping 192.168.11.Y (ssh server)
SSH Login with Root User
---------------------------------
[root@desktopX ~]# ssh root@192.168.11.Y
---------------------------------
[root@desktopX ~]# ssh root@192.168.11.Y
Are you sure you want to continue connecting (yes/no)? yes
root@192.168.11.Y's password: ******
root@192.168.11.Y's password: ******
[root@serverX ~]# who
[root@serverX ~]# useradd student
[root@serverX ~]# passwd student
: 123
: 123
[root@serverX ~]# useradd student
[root@serverX ~]# passwd student
: 123
: 123
[root@serverX ~]# exit
Linux with Specific user name:
----------------------------
[root@desktopX ~]# ssh student@192.168.11.Y
----------------------------
[root@desktopX ~]# ssh student@192.168.11.Y
[student@serverX~]$ su -
: ********
: ********
[root@serverX ~]# who
Secure Copy (scp) from Desktop:
-------------------------------
[root@desktopX ~]# scp root@192.168.11.X:/etc/passwd /root/Desktop
-------------------------------
[root@desktopX ~]# scp root@192.168.11.X:/etc/passwd /root/Desktop
Password Less ssh login:
------------------------
[root@desktopX ~]# ssh-keygen
[root@desktopX ~]# ls -l /root/.ssh
[root@desktopX ~]# ssh-copy-id 192.168.11.X
[root@desktopX ~]# ssh 192.68.11.X
------------------------
[root@desktopX ~]# ssh-keygen
[root@desktopX ~]# ls -l /root/.ssh
[root@desktopX ~]# ssh-copy-id 192.168.11.X
[root@desktopX ~]# ssh 192.68.11.X
Change Default Port:
-------------------
[root@serverX ~]# vim /etc/ssh/sshd_config
:set nu
-------------------
[root@serverX ~]# vim /etc/ssh/sshd_config
:set nu
17 #Port 22 ; old
17 Port 2015 ; new
17 Port 2015 ; new
[root@serverX ~]# systemctl restart sshd.service
Verify curren SSH port:
-----------------------
[root@serverX ~]# netstat -ntlp | grep ssh
-----------------------
[root@serverX ~]# netstat -ntlp | grep ssh
SSH Server Login with Specif Port:
---------------------------------
[root@desktopX ~]# ssh -p 2015 student@192.168.11.Y ; if student user
---------------------------------
[root@desktopX ~]# ssh -p 2015 student@192.168.11.Y ; if student user
Secure Copy (scp) with port:
----------------------------
[root@desktopX ~]# scp -r -P 2015 root@192.168.11.Y:/etc/ /root/Desktop ; if root user
----------------------------
[root@desktopX ~]# scp -r -P 2015 root@192.168.11.Y:/etc/ /root/Desktop ; if root user
* here "-r" for directory copy
Secure copy (scp) to Remote server:
-----------------------------------
[root@desktopX ~]# scp -r -P 2015 /etc/shadow 192.168.11.X:/root/
-----------------------------------
[root@desktopX ~]# scp -r -P 2015 /etc/shadow 192.168.11.X:/root/
Disabled Root Login:
--------------------
[root@serverX ~]# vim /etc/ssh/sshd_config
:set nu
--------------------
[root@serverX ~]# vim /etc/ssh/sshd_config
:set nu
48 #PermitRootLogin yes ;old
48 PermitRootLogin no ;new
48 PermitRootLogin no ;new
[root@serverX ~]# systemctl restart sshd.service
Test:
----
----
[root@desktopX ~]# ssh -p 2015 root@192.168.11.Y
[root@desktopX ~]# ssh -p 2015 student@192.168.11.Y
লিনাক্স পরিচিতি
লিনাক্স হচ্ছে মূলত একটি কার্নেল, একটি কম্পিউটারকে সচল করার জন্য নুন্যতম এবং আবশ্যিক জিনিস। কার্নেল হচ্ছে একটা কম্পিউটার প্রোগ্রাম যা আপনার কম্পিউটারের বিভিন্ন সফটওয়্যারের ইনপুট ও আউটপুট রিকোয়েস্টকে পরিচালনা করে এবং সিপিইউতে সেটার ডেটা প্রসেস করার জন্য অনুবাদও করে দেয়। অর্থাৎ আপনার কমান্ডগুলো কার্নেলের মধ্য দিয়ে অনুবাদ হয়ে সিপিইউতে যাচ্ছে আবার প্রসেস শেষে আপনার কাঙ্খিত জবাব নিয়ে আপনার মনিটর অথবা অন্য কোনো আউটপুট ডিভাইসে তার আউটপুট দিচ্ছে।
কার্নেলের সাথে আরো সফটওয়্যার, প্যাকেজ ইত্যাদি মিলে তৈরী হয় একটি অপারেটিং সিস্টেম। তা উইন্ডোজ, লিনাক্স, ওএস এক্স যাই হোক!
নতুনদের জন্য লিনাক্স নিয়ে কিছু কথা
লিনাক্স! এক অজানা ( যদিও বর্তমানে অনেক বেশী পরিচিতর মধ্যেও পড়ে 😛 ) অদ্ভুত এক নাম! বেশ কিছু মানুষের কাছে এটা একটা ভীতিকর জিনিস, আবার কিছু মানুষের মানুষের কৌতুহলের উদ্রেক ঘটায় এই জিনিস।
বাংলাদেশে বর্তমানে কম্পিউটার ব্যবহারকারী অনেক রয়েছে, কিন্তু তাদের বেশীরভাগই অনেকটা অজ্ঞ; আমি নিজেও বিজ্ঞ নই। লিনাক্স ব্যবহারকারীর সংখ্যা বাংলাদেশে তুলনামূলকভাবে বেশ বেড়েছে কিন্তু এখনো অনেক মানুষ আছে যারা জানেনই না উইন্ডোজ ছাড়া কম্পিউটার চালানো যায়। তাদের মধ্যেযারা একটু টিপে টিপে মনে করেন বেশী অভিজ্ঞতা অর্জন করে ফেলেছেন তারা কারো কম্পিউটারে লিনাক্স দেখলে জিজ্ঞেস করে বসেন এটা কোন উইন্ডোজ(!) :roll: । আবার অনেকের হালকা পাতলা ধারণা রয়েছে তারা মনে করেন লিনাক্স ক্ষতিকর কোনো কিছু অথবা এটা সার্ভার বা উঁচু স্তরের প্রোগ্রামিং অথবা হ্যাকিংয়ের জন্য ব্যবহৃত হয়!
আবার কিছু মানুষ অনেক কৌতুহল নিয়ে ঘাঁটাঘাঁটি করে কিন্তু তেমন সুযোগ না থাকায় ভালোভাবে জানা হয় না। এই লেখায় লিনাক্স নিয়ে সচরাচর কিছু প্রশ্নের উত্তর দেয়া হবে।
বাংলাদেশে বর্তমানে কম্পিউটার ব্যবহারকারী অনেক রয়েছে, কিন্তু তাদের বেশীরভাগই অনেকটা অজ্ঞ; আমি নিজেও বিজ্ঞ নই। লিনাক্স ব্যবহারকারীর সংখ্যা বাংলাদেশে তুলনামূলকভাবে বেশ বেড়েছে কিন্তু এখনো অনেক মানুষ আছে যারা জানেনই না উইন্ডোজ ছাড়া কম্পিউটার চালানো যায়। তাদের মধ্যেযারা একটু টিপে টিপে মনে করেন বেশী অভিজ্ঞতা অর্জন করে ফেলেছেন তারা কারো কম্পিউটারে লিনাক্স দেখলে জিজ্ঞেস করে বসেন এটা কোন উইন্ডোজ(!) :roll: । আবার অনেকের হালকা পাতলা ধারণা রয়েছে তারা মনে করেন লিনাক্স ক্ষতিকর কোনো কিছু অথবা এটা সার্ভার বা উঁচু স্তরের প্রোগ্রামিং অথবা হ্যাকিংয়ের জন্য ব্যবহৃত হয়!
আবার কিছু মানুষ অনেক কৌতুহল নিয়ে ঘাঁটাঘাঁটি করে কিন্তু তেমন সুযোগ না থাকায় ভালোভাবে জানা হয় না। এই লেখায় লিনাক্স নিয়ে সচরাচর কিছু প্রশ্নের উত্তর দেয়া হবে।