red hat常用配置

修改主机名

[root@vict ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=vict

"network" 2L, 29C written
[root@vict sysconfig]# hostname
vict

修改IP

[root@vict ~]# cd  /etc/sysconfig/network-scripts/
[root@vict network-scripts]# vi  ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.10.128
NETMASK=255.255.255.0
#HWADDR=00:0C:29:A4:2A:3F
ONBOOT=yes
~
~
[root@vict ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:A4:2A:3F  
          inet addr:192.168.10.128  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fea4:2a3f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:85 errors:0 dropped:0 overruns:0 frame:0
          TX packets:92 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:7355 (7.1 KiB)  TX bytes:18603 (18.1 KiB)
          Interrupt:67 Base address:0x2024 


lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:9804 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9804 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:12107876 (11.5 MiB)  TX bytes:12107876 (11.5 MiB)

开启ftp服务

[root@vict Packages]# ls -l *vsf*
-r--r--r--. 50 yangl yangl 158808 Mar  9  2011 vsftpd-2.2.2-6.el6_0.1.i686.rpm
[root@vict Packages]# ps -ef|grep ftp
root      2919  2765  0 19:40 pts/1    00:00:00 grep ftp
[root@vict Packages]# rpm -ivh vsftpd-2.2.2-6.el6_0.1.i686.rpm
warning: vsftpd-2.2.2-6.el6_0.1.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:vsftpd                 ########################################### [100%] 
[root@vict Packages]# ps -ef|grep ftp
root      2931  2765  0 19:40 pts/1    00:00:00 grep ftp
[root@vict Packages]# service vsftpd status
vsftpd is stopped
[root@vict Packages]# service vsftpd start
Starting vsftpd for vsftpd: [  OK  ]
[root@vict Packages]# service vsftpd status
vsftpd (pid 2966) is running...
[root@vict Packages]# ps -ef|grep ftp|grep -v grep
root      2966     1  0 19:40 ?        00:00:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
[root@vict Packages]# chkconfig vsftpd on
 --开启用户登陆权限
  /etc/vsftpd/ftpusers
  /etc/vsftpd/vsftpd.user_list
  /etc/vsftpd/vsftpd.conf

关闭防火墙 /etc/sysconfig/iptables

[root@vict selinux]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0           


Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         
1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (2 references)
num  target     prot opt source               destination         
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           icmp type 255 
3    ACCEPT     esp  --  0.0.0.0/0            0.0.0.0/0           
4    ACCEPT     ah   --  0.0.0.0/0            0.0.0.0/0           
5    ACCEPT     udp  --  0.0.0.0/0            224.0.0.251         udp dpt:5353 
6    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:631 
7    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:631 
8    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
9    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
10   REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

[root@vict selinux]# chkconfig iptables off
[root@vict selinux]# service iptables stop
Flushing firewall rules: [  OK  ]
Setting chains to policy ACCEPT: filter [  OK  ]
Unloading iptables modules: [  OK  ]

添加硬盘

[root@vict ~]# ls -l /dev/sd*
brw-rw----. 1 root disk 8,  0 Jul 18 20:04 /dev/sda
brw-rw----. 1 root disk 8,  1 Jul 18 20:04 /dev/sda1
brw-rw----. 1 root disk 8,  2 Jul 18 20:04 /dev/sda2
brw-rw----. 1 root disk 8,  3 Jul 18 20:04 /dev/sda3
brw-rw----. 1 root disk 8, 16 Jul 18 20:04 /dev/sdb
[root@vict ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x3bea6272.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1566, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1566, default 1566): 
Using default value 1566

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@vict ~]# ls -l /dev/sdb*
brw-rw----. 1 root disk 8, 16 Jul 18 20:05 /dev/sdb
brw-rw----. 1 root disk 8, 17 Jul 18 20:05 /dev/sdb1
[root@vict ~]# mount /dev/sdb1 /u01
mount: you must specify the filesystem type
[root@vict ~]# mkfs -t ext3 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
786432 inodes, 3144715 blocks
157235 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3221225472
96 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@vict ~]# mount /dev/sdb1 /u01
[root@vict ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             5.0G  2.2G  2.6G  46% /
tmpfs                 504M   88K  504M   1% /dev/shm
/dev/sda1             291M   30M  247M  11% /boot
/dev/sdb1              12G  159M   12G   2% /u01
使之重启后仍生效
[root@vict ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Jul 18 13:51:11 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=e759030f-689d-47cc-95f4-417b1cc05632 /                       ext4    defaults        1 1
UUID=3f8143f7-dcac-43ee-a6b7-ba9364503330 /boot                   ext4    defaults        1 2
UUID=c26542a0-2663-428b-bc71-1456abbe49cd swap                    swap    defaults        0 0
tmpfs                                     /dev/shm                tmpfs   defaults        0 0
devpts                                    /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                                     /sys                    sysfs   defaults        0 0
proc                                      /proc                   proc    defaults        0 0
/dev/sdb1                                 /u01                    ext3    defaults        1 1
~
~

关闭 SElinux

[root@vict ~]# getenforce
Enforcing
[root@vict ~]# ls -l /etc/selinux/config
-rw-r--r--. 1 root root 458 Jul 18 13:56 /etc/selinux/config
[root@vict ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

"/etc/selinux/config" 13L, 457C written
[root@vict ~]# getenforce
Enforcing
[root@vict ~]# setenforce 0
[root@vict ~]# getenforce
Permissive
[root@vict ~]# man setenforce
setenforce(1)         SELinux Command Line documentation         setenforce(1)

NAME
       setenforce - modify the mode SELinux is running in.

SYNOPSIS
       setenforce [ Enforcing | Permissive | 1 | 0 ]

DESCRIPTION
       Use  Enforcing  or  1 to put SELinux in enforcing mode.  Use Permissive or 0 to put SELinux in permissive mode.
       You need to modify /etc/grub.conf or /etc/selinux/config to disable SELinux.

AUTHOR
       Dan Walsh, <dwalsh@redhat.com>


SEE ALSO
       selinux(8), getenforce(8), selinuxenabled(8)

FILES
       /etc/grub.conf, /etc/selinux/config

配置 yum源

[root@vict Server]# pwd
/media/RHEL_5.2 i386 DVD/Server
[root@vict Server]# mkdir /rpm-packages
[root@vict Server]# cp -Rf * /rpm-packages


[root@vict yum.repos.d]# pwd
/etc/yum.repos.d
[root@vict yum.repos.d]# ls -l
total 16
-rw-r--r-- 1 root root 133 Jul 18 23:30 rhel-bendi.repo
-rw-r--r-- 1 root root 254 Apr 29  2008 rhel-debuginfo.repo
[root@vict yum.repos.d]# vi rhel-bendi.repo

[rhel-5]
name=local iso
baseurl=file:///rpm-packages/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

~
~
[root@vict yum.repos.d]# yum list

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值