User Tools

Site Tools


linux:admin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux:admin [2016/03/15 06:51] – [Increase number open files /etc/sysctl.conf] adminlinux:admin [2022/10/29 16:15] (current) – external edit 127.0.0.1
Line 3: Line 3:
 {{:linux:red_hat_linux_administration_-_a_beginner_s_guide_2003.pdf|}} {{:linux:red_hat_linux_administration_-_a_beginner_s_guide_2003.pdf|}}
  
-===== install software ===== +===== Fix Old CentOS Repos ===== 
-==== install rpm package ====+Maintainece update not supported from **2020/11/30** => you must config repos to new mirror for Fixing yum error: 
 +<code bash> 
 +yum list 
 +Failed to set locale, defaulting to C 
 +Loaded plugins: fastestmirror 
 +Determining fastest mirrors 
 +YumRepo Error: All mirror URLs are not using ftp, http[s] or file. 
 + Eg. Invalid release/repo/arch combination/ 
 +removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt 
 +</code> 
 + 
 +Steps: 
 +  - Step1: **Update /etc/yum.repos.d/CentOS-Base.repo** 
 +<code bash> 
 +[base] 
 +name=CentOS-$releasever - Base 
 +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra 
 +baseurl=http://vault.centos.org/6.10/os/$basearch/ 
 +gpgcheck=1 
 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
 +#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
 +#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
 +#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
 +#contrib - packages by Centos Users 
 +[contrib] 
 +name=CentOS-$releasever - Contrib 
 +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra 
 +baseurl=http://vault.centos.org/6.10/contrib/$basearch/ 
 +gpgcheck=1 
 +enabled=0 
 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
 +</code> 
 +  - Step2:<code bash> 
 +yum clean all 
 +</code> 
 +===== Install software ===== 
 +==== Install rpm package ====
   mount /dev/cdrom /mnt/cdrom/   mount /dev/cdrom /mnt/cdrom/
   cd /mnt/cdrom/CentOS   cd /mnt/cdrom/CentOS
Line 102: Line 138:
   * Remove user and home directory itself and the user´s mail spool. <code bash>   * Remove user and home directory itself and the user´s mail spool. <code bash>
 userdel -r anhvc userdel -r anhvc
 +</code>
 +  * Add System User:<code bash>
 +#Create User and not create Home Directory
 +useradd -M dovecot
 +#Lock User not allow login
 +usermod -L dovecot
 </code> </code>
 ==== Admin group  ==== ==== Admin group  ====
Line 272: Line 314:
 gateway 123.30.133.129 gateway 123.30.133.129
 netmask 255.255.255.128 netmask 255.255.255.128
-network 123.30.133.128 +network 123.30.133.128#custom 
-broadcast 123.30.133.255+broadcast 123.30.133.255#custom
 </code>And run command below to active config:<code bash> </code>And run command below to active config:<code bash>
 /etc/init.d/networking restart /etc/init.d/networking restart
 </code> </code>
-==== Check netword card ====+==== Check network card ====
 <code bash> <code bash>
 /sbin/ifconfig -a /sbin/ifconfig -a
Line 312: Line 354:
 </code> </code>
 === Dynamic route === === Dynamic route ===
-Redhat: update route in /etc/sysconfig/network-scripts/route-eth1 <code bash>+  * Redhat: update route in /etc/sysconfig/network-scripts/route-eth1 <code bash>
 cat > /etc/sysconfig/network-scripts/route-eth1 cat > /etc/sysconfig/network-scripts/route-eth1
- 
 10.199.44.0/24 via 10.30.31.1 10.199.44.0/24 via 10.30.31.1
 10.199.51.5/32 via 10.30.31.1 10.199.51.5/32 via 10.30.31.1
Line 326: Line 367:
 echo '10.30.15.16/32 via 10.30.31.1' >> /etc/sysconfig/network-scripts/route-eth1 echo '10.30.15.16/32 via 10.30.31.1' >> /etc/sysconfig/network-scripts/route-eth1
 route add -host 10.30.15.16 gw 10.30.31.1 route add -host 10.30.15.16 gw 10.30.31.1
 +</code>And active configure:<code bash>
 +/sbin/service network restart
 +</code>
 +  * Debian: Edit **/etc/network/interfaces**<code bash>
 +up route add -net 10.8.0.0 netmask 255.255.255.0 gw 192.168.1.11
 +down route del -net 10.8.0.0 netmask 255.255.255.0 gw 192.168.1.11
 +</code>And active configure:<code bash>
 +/etc/init.d/networking restart
 </code> </code>
 ==== DNS ==== ==== DNS ====
Line 407: Line 456:
 === crontab configuration file base on linux user === === crontab configuration file base on linux user ===
   * cat /var/spool/cron/root <code>   * cat /var/spool/cron/root <code>
-*/30 * * * * /usr/sbin/ntpdate 118.102.5.136+*/30 * * * * /usr/sbin/ntpdate  pool.ntp.org
 */5 * * * * /usr/local/bin/iostat.sh */5 * * * * /usr/local/bin/iostat.sh
 14 2 * * * /etc/webmin/cron/tempdelete.pl 14 2 * * * /etc/webmin/cron/tempdelete.pl
Line 444: Line 493:
 ls /home/anhvc  ls /home/anhvc 
 => 214501_170809.txt => 214501_170809.txt
 +</code>
 +=== Create contab to update date/time of system ===
 +  - Step1: Install ntpdate<code bash>
 +yum install ntpdate
 +</code>
 +  - Step2: Create contab content:<code bash>
 +*/30 * * * * /usr/sbin/ntpdate  pool.ntp.org
 </code> </code>
 ==== logrotate ==== ==== logrotate ====
linux/admin.1458024675.txt.gz · Last modified: 2022/10/29 16:15 (external edit)