Chinaunix首页 | 论坛 | 博客
  • 博客访问: 137421
  • 博文数量: 25
  • 博客积分: 460
  • 博客等级: 下士
  • 技术积分: 252
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-11 10:48
个人简介

努力学习,谦虚请教,不断提升!

文章分类

全部博文(25)

文章存档

2015年(3)

2014年(4)

2013年(3)

2012年(9)

2011年(6)

我的朋友

分类: LINUX

2012-05-25 16:55:00

1、修改主机环境变量,使其可以支持中文显示;
在/etc/profile文件中添加export LANG=zh_CN
执行./etc/profile让环境变量生效
2、修改主机名称
修改/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=jstnmsapp2
在/etc/hosts添加主机名称映射关系
192.168.210.113  jstnmsapp2
3、对新加的硬盘进行加载
 3.1、进行分区,这里将整个硬盘划分为一个主分区即可;
[root@jstnmsapp2 ~]# 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 0x5627a0d3.
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): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-26108, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-26108, default 26108):
Using default value 26108
Command (m for help): p
Disk /dev/sdb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5627a0d3
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       26108   209712478+  83  Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
 3.2、对划分好的分区进行格式化
[root@jstnmsapp2 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
13107200 inodes, 52428119 blocks
2621405 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
1600 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,
        4096000, 7962624, 11239424, 20480000, 23887872
正在写入inode表: 完成                           
Creating journal (32768 blocks):
完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 3.3、将格式好的硬盘mount上
mkdir /ftp
mount /dev/sdb1 /ftp
[root@jstnmsapp2 ~]# df -h
文件系统              容量  已用  可用 已用%% 挂载点
/dev/mapper/VolGroup-lv_root
                       18G  2.6G   14G  16% /
tmpfs                 3.9G   88K  3.9G   1% /dev/shm
/dev/sda1             485M   44M  417M  10% /boot
/dev/sdb1             197G  188M  187G   1% /ftp 
 3.4、将/dev/sdb1添加到随系统启动而启动
vi /etc/fstab
/dev/sdb1               /ftp                    ext4    defaults        0 0
4、关闭linux(iptables、SELinux)服务
 4.1、关闭iptables
[root@localhost sysconfig]# chkconfig --list|grep iptable
iptables        0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭
[root@localhost sysconfig]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination        
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0          
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0          
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination        
1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination        
[root@localhost sysconfig]# service iptables stop
iptables: Flushing firewall rules: [  OK  ]
iptables: Setting chains to policy ACCEPT: filter [  OK  ]
iptables: Unloading modules: [  OK  ]
[root@localhost sysconfig]# service iptables status
iptables: Firewall is not running.
[root@localhost sysconfig]# chkconfig --help
chkconfig 版本 1.3.47 - 版权 (C) 1997-2000 Red Hat, Inc.
在 GNU 公共许可的条款下,本软件可以被自由发行。
用法:   chkconfig [--list] [--type ] [name]
         chkconfig --add
         chkconfig --del
         chkconfig --override
         chkconfig [--level ] [--type ]
[root@localhost sysconfig]# chkconfig iptables off 
 4.2、关闭SELinux
修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启
如果不想重启系统,使用命令setenforce 0
5、配置tnms2用户
 5.1、创建tnms2用户
useradd -d /ftp/home/tnms2 -m tnms2
passwd tnms2
 5.2、添加tnms2环境变量
省略。。。。
6、安装ftp和telnet服务,请使用root用安装;
rpm -ivh xinetd-2.3.14-31.el6.x86_64.rpm
rpm -vih vsftpd-2.2.2-6.el6_0.1.x86_64.rpm
rpm -vih ftp-0.17-51.1.el6.x86_64.rpm
rpm -vih telnet-server-0.17-46.el6.x86_64.rpm
rpm -vih telnet-0.17-46.el6.x86_64.rpm
安装完成后,请手动启动服务;
[root@jstnmsapp2 opt]# service xinetd start
[root@jstnmsapp2 opt]# service vsftpd start
[root@jstnmsapp2 opt]# chkconfig xinetd on
[root@jstnmsapp2 opt]# chkconfig vsftpd on
7、重启系统是配置生效
[root@tnmsapp2 ~]# reboot
8、配置ssh自动登录
[tnms2@tnmsapp2 .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/ftp/home/tnms2/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /ftp/home/tnms2/.ssh/id_rsa.
Your public key has been saved in /ftp/home/tnms2/.ssh/id_rsa.pub.
The key fingerprint is:
c9:30:94:f7:53:02:71:80:50:af:18:e8:99:ae:b5:1f
The key's randomart image is:
+--[ RSA 2048]----+
|    .ooo++.      |
|   . .o.... .    |
|  . . o... o     |
| . o o = .o      |
|  + . . S  .     |
| .               |
|  o E            |
| o . .           |
|. ...            |
+-----------------+
阅读(1214) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~