카테고리 없음

RHCSA 8일차 부서버리기

kiminaki 2021. 6. 29. 01:29

1. Configure your Host Name, IP Address, Gateway and DNS.
Host name: station.domain40.example.com

안의 파일이
/etc/sysconfig/network
hostname=abc.com
hostname abc.com
되어 있다 가정 


IP Address:172.24.40.40/24 -

Gateway172.24.40.1 -

DNS:172.24.40.1 -

 

 

 

#cd /etc/sysconfig/network-scripts/

#ls

#vi ifcfg-ens33

dhcp 부분을 #을통해 주석처리한다

IPADDR=172.24.40.40

GATEWAY=172.24.40.1

PREFIX=24

DNS1=172.24.40.1

 

systemctl restart network

 

이러면 ip가 변경

 

호스트네임변경

hostnamectl set-hostname station.domain40.example.com

 

reboot 

  

2. Create a catalog under /home named admins. Its respective group is requested to be the admin group. The group users could read and write, while other users are not allowed to access it. The files created by users from the same group should also be the admin group.

  214  mkdir /home/admins
  215  groupadd admin
  216  chown .admin /home/admins
  217  chmod 770 /home/admins
  218  chmod 2770 /home/admins
  219  history




3.Configure a task: plan to run echo hello command at 14:23 every day.

 

crontab -e

23 14 * * * root /bin/echo "hello"

:wq

 

crontab -l

4.Find the files owned by harry, and copy it to catalog: /opt/dir

 

find / -user harry -exec cp {} /opt/dir \;

 

5. Find the rows that contain abcde from file /etc/testfile, and write it to the file/tmp/testfile, and the sequence is requested as the same as /etc/testfile.

 

cat /etc/testfile | grep "abcde" > /tmp/testfile


6. Configure a HTTP server, which can be accessed through
http://station.domain40.example.com.
Please download the released page from http://ip/dir/example.html.

 

 

yum -y install httpd                                                            아파치설치

systemctl start httpd

systemctl enable httpd                                                         (영구실행)

 

wget http://192.168.0.137/dir/kim                                 "http://ip/디렉터리/파일" 이걸 받아 온다음

cp kim /var/www/html                                                파일을 옮긴다.

 

vi /etc/httpd/conf/httpd.conf                         station.domain40.example.com로 접속해주기 위해 설정파일로 간다

 

#SeverName 부분을 찾아 주석을 제거한후  station.domain40.example.com을 추가하면 된다. 그러고 url입력하면 

 

 

                              

 

 

 

 



7. Configure autofs to make sure after login successfully, it has the home directory autofs, which is shared as /rhome/ldapuser40 at the ip: 172.24.40.10. and it also requires that, other ldap users can use the home directory normally.

8.Configure the system synchronous as 172.24.40.10(안배운거)

 

자세하게 살펴보도록 하겠다.

먼저 동기화로 시간동기화인 ntp를 사용하도록 한다.

 

서버측 설정

 

  yum -y install chrony                                            ntp 설치

  vi /etc/chrony.conf                                               설정파일에서 설정 변경

  allow 192.168.0.0/24                                       ntp 클라이언트 수용할 수 있게 설정을 추가 해준다.

 

그리고 방화벽열기

  firewall-cmd --permanent --add-service=ntp

 firewall-cmd --reload

 

systemctl restart chrony

systemctl enable chrony

 

 

클라이언트측 설정

yum -y install chrony
vi /etc/chrony.conf

#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst                 필요없는 부분 주석처리하고
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 192.168.0.137                                     연결한 ntp 주소를 설정한다.

 

 

firewall-cmd --permanent --add-service=ntp
firewall-cmd --reload
systemctl restart chronyd

systemctl enable chronyd

 

 

서버측에서 클라이언트 확인

 

 

클라이언트 측에서 서버 확인

 

그래서 문제에서는 클라이언트측에서의 설정인데, 

문제를 풀이이 해보자

 

 

systemctl status chrony               상태확인

vi /etc/chrony.conf         설정파일 변경

server 서버ip    서버 ip를 입력해준다

 

 

timedatectl set-ntp  true
systemctl enable --now chrony

(굳이 이부분은 까진 안해도 될거같지만 투표를 가장 많이 받았다.

 


9. Create a volume group, and set 16M as a extends. And divided a volume group containing 50 extends on volume group lv, make it as ext4 file system, and mounted automatically under /mnt/data.

 

  pvcreate /dev/sdb1
  pvcreate /dev/sdb2
  vgcreate -s 16M vg0 /dev/sdb1 /dev/sdb2
  lvcreate -l 50 -n lv0 vg0

 mkfs.xfs /dev/vg0/lv0

mkdir /mnt/data

vi /etc/fstab

/dev/vg0/lv0    /mnt/data       xfs     defaults        0 0

 

mount -a





10. Create a 512M partition, make it as ext4 file system, mounted automatically under /mnt/data and which take effect automatically at boot-start.

 

fdisk /dev/sdb

 

n

p

+512M

w

 

mkfs.xfs /dev/sdb1

vi /etc/fstab

/dev/sdb1       /mnt/data       xfs     defaults 0 0

wq

 

mount -a