Linux basic settings

Keywords: iptables firewall Java sudo

Download CentOS version 6.4 system

1: Modify IP address (system -- > preferences -- > network connections)

2. Add user

[root@localhost ~]# adduser hadoop
[root@localhost ~]# passwd hadoop
Changing password for user hadoop.
New password: 
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password: 
passwd: all authentication tokens updated successfully.

3: reboot

4: Set host name

[root@localhost ~]# hostname
localhost.localdomain
[root@localhost ~]# hostname bigdata-pro01.rachel.com
[root@localhost ~]# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=bigdata-pro01.rachel.com

//After pressing ESC key, input: wq to save

5: Host name and IP address mapping

[root@localhost ~]# vi /etc/hosts
192.168.1.10    bigdata-pro01.rachel.com

6: reboot

7: Mapping with host file in windows

     C:\Windows\System32\drivers\etc
    192.168.1.10    bigdata-pro01.rachel.com

8: View firewall status: at this time, the firewall is not running. If the current user is not root, you need to join sudo

[root@bigdata-pro01 ~]# service iptables status
iptables: Firewall is not running.

9: No password is required to set the switch between normal user and root user

[rachel@bigdata-pro01 ~]$ su
Password: 
[root@bigdata-pro01 rachel]# vi /etc/sudoers
rachel ALL=(root)NOPASSWD:ALL
//Save changes (ESC -- > < input >: WQ)
[root@bigdata-pro01 rachel]# exit

10: After the firewall is restarted, it is still closed

sudo vim /etc/sysconfig/selinux
SELINUX=disabled

11: Demonstration of common firewall opening and closing commands

[rachel@bigdata-pro01 ~]$ sudo service iptables start
iptables: Applying firewall rules: [  OK  ]
[rachel@bigdata-pro01 ~]$ sudo service iptables stop
iptables: Flushing firewall rules: [  OK  ]
iptables: Setting chains to policy ACCEPT: filter [  OK  ]
iptables: Unloading modules: [  OK  ]

12: Uninstall OpenJDK

Generally, the Centos system downloaded from Alibaba cloud has openJdk. We need to uninstall it

[rachel@bigdata-pro01 ~]$ sudo rpm -qa|grep java
java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.x86_64
tzdata-java-2012j-1.el6.noarch
java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6_3.x86_64
[rachel@bigdata-pro01 ~]$ sudo rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.x86_64 tzdata-java-2012j-1.el6.noarch java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6_3.x86_64

 

Posted by morphius on Tue, 31 Dec 2019 07:15:00 -0800