[iyunv@localhost ~]# cd /etc/yum.repos.d/
[iyunv@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo #Media就是本地yum源的配置文件。
[iyunv@localhost yum.repos.d]# vi CentOS-Media.repo
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-6. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///opt/cdrom #指定了三个光盘有可能挂载的路径。
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=1 #enabled=0 这里的0代表缺省源不存在,1代表启用。
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# wq保存退出。
如果你的linux能够上互联网,那么备份Base这个配置文件。
[iyunv@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
2.3 安装gcc, gcc-c++
# 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=enforcing # 把SELINUX=enforcing 更改为SELINUX更改为disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
4.1.2临时关闭(不需要重启系统)
4.3 安装三步走configure ---make ---make install
configure 检测系统配置,检测软件安装所需要的软件。
make 编译二进制文件为可执行文件。
make install 安装软件。
4.3.1编译安装xml2
[iyunv@localhost packget]# cd libxml2-2.6.30
[iyunv@localhost libxml2-2.6.30]#
[iyunv@localhost packget]# cd libxml2-2.6.30
[iyunv@localhost libxml2-2.6.30]# ./configure --prefix=/usr/local/libxml2/
checking build system type... x86_64-redhat-linux-gnu
checking host system type... x86_64-redhat-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... gcc
------------省略一部分过程----------
config.status: creating python/setup.py
config.status: creating config.h
config.status: executing depfiles commands
Done configuring
[iyunv@localhost libxml2-2.6.30]#
检测完成,接下来make编译
[iyunv@localhost libxml2-2.6.30]# make
make all-recursive
make[1]: Entering directory `/root/packget/libxml2-2.6.30'
Making all in include
make[2]: Entering directory `/root/packget/libxml2-2.6.30/include'
Making all in libxml
--------------省略编译过程-----------
make[2]: Entering directory `/root/packget/libxml2-2.6.30/xstc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/packget/libxml2-2.6.30/xstc'
make[1]: Leaving directory `/root/packget/libxml2-2.6.30'
[iyunv@localhost libxml2-2.6.30]#
编译完成之后开始make install
[iyunv@localhost libxml2-2.6.30]# make install
Making install in include
make[1]: Entering directory `/root/packget/libxml2-2.6.30/include'
Making install in libxml
make[2]: Entering directory `/root/packget/libxml2-2.6.30/include/libxml'
make[3]: Entering directory `/root/packget/libxml2-2.6.30/include/libxml'
make install-exec-hook
---------------省略步奏-----------
Making install in xstc
make[1]: Entering directory `/root/packget/libxml2-2.6.30/xstc'
make[2]: Entering directory `/root/packget/libxml2-2.6.30/xstc'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/root/packget/libxml2-2.6.30/xstc'
make[1]: Leaving directory `/root/packget/libxml2-2.6.30/xstc'
[iyunv@localhost libxml2-2.6.30]#
libxml2安装完成。
同样的方法安装libmcrpyt
[iyunv@localhost zlib-1.2.3]# ./configure
Checking for gcc...
Building static library libz.a version 1.2.3 with gcc.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... Yes.
[iyunv@localhost zlib-1.2.3]# make
gcc -O3 -DUSE_MMAP -c -o example.o example.c
gcc -O3 -DUSE_MMAP -c -o adler32.o adler32.c
gcc -O3 -DUSE_MMAP -c -o compress.o compress.c
gcc -O3 -DUSE_MMAP -c -o crc32.o crc32.c
gcc -O3 -DUSE_MMAP -c -o gzio.o gzio.c
gcc -O3 -DUSE_MMAP -c -o uncompr.o uncompr.c
gcc -O3 -DUSE_MMAP -c -o deflate.o deflate.c
gcc -O3 -DUSE_MMAP -c -o trees.o trees.c
gcc -O3 -DUSE_MMAP -c -o zutil.o zutil.c
gcc -O3 -DUSE_MMAP -c -o inflate.o inflate.c
gcc -O3 -DUSE_MMAP -c -o infback.o infback.c
gcc -O3 -DUSE_MMAP -c -o inftrees.o inftrees.c
gcc -O3 -DUSE_MMAP -c -o inffast.o inffast.c
ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
gcc -O3 -DUSE_MMAP -o example example.o -L. libz.a
gcc -O3 -DUSE_MMAP -c -o minigzip.o minigzip.c
gcc -O3 -DUSE_MMAP -o minigzip minigzip.o -L. libz.a
[iyunv@localhost zlib-1.2.3]# make install
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
cp libz.a /usr/local/lib
cd /usr/local/lib; chmod 755 libz.a
cd /usr/local/lib; if test -f libz.so.1.2.3; then \
rm -f libz.so libz.so.1; \
ln -s libz.so.1.2.3 libz.so; \
ln -s libz.so.1.2.3 libz.so.1; \
(ldconfig || true) >/dev/null 2>&1; \
fi
cp zlib.3 /usr/local/share/man/man3
chmod 644 /usr/local/share/man/man3/zlib.3
[iyunv@localhost zlib-1.2.3]#
编译安装libpng如果出现如下错误,是应为你的环境是64位系统,匹配不了zlib库。
/usr/local/lib/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [libpng12.la] 错误 1
make[1]: Leaving directory `/root/packget/libpng-1.2.31'
make: *** [all] 错误 2
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP
在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
接下面步骤
make
make install
编译安装libpng
[iyunv@localhost libpng-1.2.31]# ./configure -prefix=/usr/local/libpng/
[iyunv@localhost libpng-1.2.31]# make
[iyunv@localhost libpng-1.2.31]# make install
libpng安装完成。
[iyunv@localhost ncurses-5.6]# ./configure --with-shared --without-debug --without-ada --enable-overwrite
[iyunv@localhost ncurses-5.6]# make
[iyunv@localhost ncurses-5.6]# make install
编译安装mysql:
首先创建mysql用户以及用户组:
[iyunv@localhost mysql-5.0.41]# groupadd mysql
[iyunv@localhost mysql-5.0.41]# grep mysql /etc/group mysql:x:500:
[iyunv@localhost mysql-5.0.41]# useradd -g mysql mysql
[iyunv@localhost mysql-5.0.41]# ./configure --prefix=/usr/local/mysql --with-extra-charsets=all # extra 允许所有字符集
[iyunv@localhost mysql-5.0.41]# make
[iyunv@localhost mysql-5.0.41]# make install
配置mysql:
把源码包中的my-medium.cnf拷贝的/etc/下命名为my.cnf:
[iyunv@localhost ~]# /usr/local/mysql/bin/mysqladmin version
/usr/local/mysql/bin/mysqladmin Ver 8.41 Distrib 5.0.41, for unknown-linux-gnu on x86_64
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 5.0.41-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 3 min 56 sec
Threads: 1 Questions: 1 Slow queries: 0 Opens: 12 Flush tables: 1 Open tables: 6 Queries per second avg: 0.004
[iyunv@localhost ~]#
查看版本的配置参数:
[iyunv@localhost ~]# /usr/local/mysql/bin/mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.41-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
mysql> set password for 'root'@'localhost'=PASSWORD('thinklinux');
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
[iyunv@localhost ~]# cd /usr/local/apache2/conf/
[iyunv@localhost conf]# vi httpd.conf
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
Addtype application/x-httpd-php .php .phtml #理论上这个Addtype 中的t应该是大写,
#但是在有的版本的linux中不能解析网页文件。
/AddType #打开网站是空白,没有报错日志,跟这个有关系吧。所以可以尝试小写。
加入这个选项之后重启apache
[iyunv@localhost ~]# cd /usr/local/apache2/htdocs/
[iyunv@localhost htdocs]# vi info.php
写入如下代码:
<?php
phpinfo();
?>