NEW INSTALL CentOS(mini)
一、不能上网
1.vi /etc/resolv.conf
nameserver 8.8.8.8
2.vm内的初始文件
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:25:AC:36
TYPE=Ethernet
UUID=ec37da45-eaca-4b61-baf6-a755ee277faa
ONBOOT=no //no改为yes启动网络
NM_CONTROLLED=yes
BOOTPROTO=dhcp
//单个服务器可能的配置
DEIVCE=eth0
BOOTPROTO=none
ONBOOT=yes
127.0.0.1
TYPE=Ethernet
HWADDR=00:11:44:BD:RG:5E
IPADDR=192.168.1.141
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.1
3.修改hostname
直接输入hostname,或者cat /proc/sys/kernel/hostname可以查看本机的hostname;
修改运行时的Linux系统的hostname,不需要重启系统。
#hostname newname //重启后丢失所做修改
#vi /etc/sysconfig/network
HOSTNAME=NEWNAME //永久生效,重启后变掉,当前shell不变root@localhost
二、yum源
1.yum install
wget //下载文件
curl curl-dev //git联网用
perl //安装vm tools
//安装mysql依赖库和开发工具
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
//安装nginx
yum -y install pcre-devel zlib-devel
//安装php
yum -y install gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel curl-devel freetype-devel
2.更换国内源
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS6-Base-163.repo CentOS-Base.repo
yum clean all
三、安装桌面环境
1.yum groupinstall "X Window System" "Desktop"
//网上说的"GNOME Desktop Environment"是老版本
2.设置开机启动桌面
vi /etc/inittab
id:5:initdefault
改为:
id:3:initdefault
3.桌面设置
Applications-->System Tools-->Terminal 右键发送到桌面或者上侧任务栏;
System-->Preferences-->File Management-->Behavior 勾选Always open in browser windows,就跟windows里面访问文件系统一样。
4.分辨率调整
4.1.安装vm tools
VM-->Install VM Tools(需要把文件拖出来解压,默认桌面)
tar -zxvf VMwareTools
cd vmware-tools-distrib
yum install perl
./vmware-install.pl
四、安装中文支持
1.yum install "@Chinese Support";
2.System-->Preferences-->Input Method add PinYin输入法到列表中,重新登陆。
NEW INSTALL CentOS(bin)
二、http://www.jspxcms.com/knowledge/140.html u盘装centos系统
1、准备一个8G以上的u盘。
2、虚拟机挂载u盘。
3、检查当前磁盘情况
fdisk -l
//u盘通常为/dev/sdb
4、分两个区,第一个fat32,约250M。剩下的为ext3。
fdisk /dev/sdb
//删除所有的分区。重复多次,直到所有分区都被删除
//并提示No partition is defined yet!
d
// 创建分区
n
p
1
<enter>
+250M
//修改分区类型,为W95 FAT32
t
b
//创建第二个分区
n
p
2
<enter>
<enter>
//启动区标志
a
1
w
5、格式化
//下载格式化工具
yum install dosfstools
mkfs.vfat -n BOOT /dev/sdb1
mkfs.ext3 -m 0 -b 4096 -L DATA /dev/sdb2
6、重新拔插u盘
7、挂载u盘
mkdir /media/BOOT
mount /dev/sdb1 /media/BOOT
mkdir /media/DATA
mount /dev/sdb2 /media/DATA
8、挂载Centos DVD1
//进入安装光盘目录,/mnt/hgfs/centos为作者机器上的目录,读者根据实际情况调整。
cd /mnt/hgfs/centos
mkdir /mnt/tmp
mount -t iso9660 CentOS-6.4-x86_64-bin-DVD1.iso /mnt/tmp -o loop,ro
9、拷贝isolinux、images文件到u盘BOOT分区
cp -r /mnt/tmp/isolinux /media/BOOT/
cd /media/BOOT/
mv isolinux syslinux
mv syslinux/isolinux.cfg syslinux/syslinux.cfg
cp -r /mnt/tmp/images /media/BOOT/
10、安装syslinux
yum install syslinux
syslinux /dev/sdb1
11、拷贝images、DVD1、DVD2到u盘DATA分区
cp -pr /mnt/tmp/images /media/DATA/
cd /mnt/hgfs/centos/
for i in 1 2; do cp -v CentOS-6.4-x86_64-bin-DVD${i}.iso /media/DATA/; sync; done
12、卸载u盘
umount /mnt/tmp
umount /media/BOOT
umount /media/DATA
INSTALL SOFTWARE
一、安装mysql5.5
1.删除原有的mysql源
rpm -qa|grep -i mysql
rpm -e -nodeps mysql_*
删除源用 yum remove mysql_*
将文件拷贝到/usr/local/src下面
rpm -ivh mysql_*
yum install mysql
2.源码编译安装
//依赖库和开发工具
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
//安装mysql
yum -y install bison gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool-ltdl-devel* mysql-devel
3.从mysql5.5之后,不在使用configure安装,使用cmake
wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
tar -zxvf cmake-2.8.6.tar.gz
cd cmake-2.8.6/
./configure
make && make install
4.mysql配置用户
groupadd mysql
useradd -r -g mysql mysql
cd /usr/local
tar -zxvf /usr/local/src/mysql-VERSION-OS.tar.gz
ln -s full-path-tomysql-VERSION-OS mysql
cd mysql
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
//my-medium,-large等等都是试机器内存而定的
cp support-files/my-huge.cnf /etc/my.cnf
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server
二、安装nginx
yum -y install pcre-devel zlib-devel
三、安装php
yum -y install gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel curl-devel freetype-devel