centos安装最小php,CentOS5最小安装Apahce+MySQL+PHP+GD+Zend

安装CentOS, 我的是CentOS5.0 - DVD

最小化安装不安装任何软件.

2. 关闭selinux

A.运行命令setup,可以在图形化界面进行关闭

B. vi /etc/sysconfig/selinux

SELINUX=enforcing 改成 SELINUX=disabled

3. 关闭不需要服务

A:运行命令setup

B:运行命令ntsysv

只启用下面9个服务(autofs是为了方便使用光驱,其实可以不启用这个服务)

acpid

anacron

autofs

cpuspeed

crond

network

sshd

syslog

yum-updatesd

4. 配置ssh

修改两个地方

vi /etc/ssh/sshd_config

#PermitRootLogin yes 改为

PermitRootLogin yes

#UseDNS yes 改为

UseDNS no

5.配置yum , 使用中国镜象下载方法:

先把原来的配置文件备份

#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

#vi /etc/yum.repos.d/CentOS-Base.repo

..............................

#yum update

6. 安装编译器gcc

最小化安装,没有安装编译器

#yum install gcc gcc-c++

如果不安装,在编译mysql的时候会出现【exec: g++: not found】错误

7.下载软件:

ncurses

http://ftp.gnu.org/pub/gnu/ncurses/ncurses- 5.6.tar.gz

安装GD库和GD库所需的环境

zlib

http://www.zlib.net/zlib-1.2.3.tar.gz

jpeg

ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz

freetype

http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz

png

ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng- 1.2.26.tar.gz

GD

http://www.libgd.org/releases/gd-2.0.35.tar.gz

安装php必须安装libxml

wget ftp://xmlsoft.org/libxml2/libxml2-2.6.31.tar.gz

apache2.2.8

http://apache.mirror.phpchina.com/httpd/httpd-2.2.8.tar.gz

phpmyadmin2.11.5.2

http://4.gxdx1.crsky.com/200804/phpMyAdmin-v2.11.5.2.rar

Zend3.3

http://downloads.zend.com/ZendOptimizer-3.3.0-linux-glibc21-i386.tar.gz

php5.2.5

http://cn.php.net/distributions/php-5.2.5.tar.gz

mysql5.051

http://mirror.trouble- free.net/mysql_mirror/Downloads/MySQL-5.0/mysql-5.0.51a.tar.gz

——————-

1:安装ncurses-5.6

tar zxvf ncurses-5.6.tar.gz

cd ncurses-5.6

./configure --prefix=/usr --with-shared --without-debug && make && make install

cd ..

2:安装mysql

tar -zxvf mysql-5.0.51a.tar.gz

cd mysql-5.0.51a

./configure --with-mysqld-user=mysql --prefix=/usr/local/mysql5 --with-extra-charset=all --without-isam --exec-prefix=/usr/local/mysql5 && make && make install

3:初始化数据库:

groupadd mysql

useradd -g mysql mysql

scripts/mysql_install_db

cp /usr/local/mysql5/share/mysql/my-medium.cnf /usr/local/mysql5/var/my.cnf

cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqld

chkconfig –add mysqld

chkconfig –level 2345 mysqld on

chown mysql:mysql -R /usr/local/mysql5/

service mysqld start

ln -s /usr/local/mysql5/bin/mysql /sbin/mysql

ln -s /usr/local/mysql5/bin/mysqladmin /sbin/mysqladmin

4:设定mysql密码

mysqladmin -uroot password “123456″

5:让系统找到mysql(如果必要的话):

PATH=$PATH:/usr/local/mysql5/bin

export PATH

echo “/usr/local/mysql5/lib/mysql” >> /etc/ld.so.conf

ldconfig

6::测试

netstat -nplt | grep mysql

ps aux|grep mysql

5.2 安装apache

1:编译安装

tar zxvf httpd-2.2.8.tar.gz

cd httpd-2.2.8

./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite && make && make install

/usr/local/apache2/bin/apachectl configtest

/usr/local/apache2/bin/apachectl start

/usr/local/apache/bin/apachectl stop

2:修改默认启动页

vi /usr/local/apache2/conf/httpd.conf

DirectoryIndex index.html 改为

DirectoryIndex index.html index.php index.jsp

#ServerName www.example.com:80 改为

ServerName www.example.com:80

3:apache 开机启动的办法

1:#echo “/usr/local/apache/bin/apachectl start” >>/etc/rc.local(系统启动时服务自动启动)

2:创建一个httpd启动脚本,内容如下:

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

vi /etc/init.d/httpd

在第三行添加以下内容

#chkconfig:345 85 15

#description: Start and stops the Apache HTTP Server.

chmod +x /etc/rc.d/init.d/httpd

chkconfig –add httpd

修改乱码

步骤1:

在httpd.conf中将Include conf/extra/httpd-autoindex这个模块的注释去掉

@vi /usr/local/apache/conf/httpd.conf

步骤2:

在httpd-autoindex.conf中加入IndexOptions Charset=UTF-8

@vi /usr/local/apache/conf/extra/httpd-autoindex.conf

修改网页存放路径

vi /usr/local/apache/conf/httpd.conf

mkdir /www

DocumentRoot "/www"

5.3 安装GD

1:安装ZLIB2

######zlib#############

tar zxvf zlib-1.2.3.tar.gz

cd zlib-1.2.3

./configure

make

make install clean

2:安装PNG

##########libpng###########

tar zxvf libpng-1.2.26.tar.gz

cd libpng-1.2.26

cp scripts/makefile.linux ./makefile

./configure –prefix=/usr/local/libpng

make

make install clean

3:安装freetype

##########freetype#########

cd freetype-2.3.5

./configure

make

make install

4:安装JPEG6

#########jpeg###############

tar zxvf jpegsrc.v6b.tar.gz

cd jpeg-6b

mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1}

./configure --prefix=/usr/local/jpeg --enable-shared --enable- static && make && make install

5:安装GD

########GD###########

tar zxvf gd-2.0.35.tar.gz

cd gd-2.0.35

./configure --with-png --with-freetype --with-jpeg=/usr/local/jpeg/&&make && make install

5.4 安装php

1:安装LIBXML2

#####libxml2 #####

tar zxvf libxml2-2.6.31.tar.gz

cd libxml2-2.6.31

./configure –prefix=/usr/local/libxml2

make

make install

cp xml2-config /usr/bin

2::安装PHP5.2.5

#########php##########

tar zxvf php-5.2.5.tar.gz

cd php-5.2.5

tar zxvf php-5.2.5.tar.gz

cd php-5.2.5

./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql5 --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/include/freetype2 --with-zlib --with-png-dir=usr/local/libpng12 --with-libxml-dir=/usr/local/libxml2 --with-gd --enable-ftp --enable-sockets -enable-mbstring=all- --with-mcrypt

make && make install

cp php.ini-dist /usr/local/php5/lib/php.ini

如果出现类似:

checking lex output file root... ./configure: line 3276: lex: command not found

这是由于缺少编译器解释文法的工具flex

执行

#yum install flex

重新编译

./configure ………………

make

make test

make install

3:配置

cp php.ini-dict /usr/local/php5/lib/php.ini

编辑httpd.conf

/usr/local/apache2/conf/httpd.conf

加载php模块,去掉注释,我的版本是缺省就启用的。

LoadModule php5_module modules/libphp5.so

加上下面两行

AddType application/x-httpd-php .php .phtml

AddType application/x-httpd-php-source .phps

5.5 安装zend

tar -zxvf ZendOptimizer-3.0.0-linux-glibc23- x86_64.tar.gz

cd ZendOptimizer-3.0.0-linux-glibc23-x86_64

./install

5.6 安装phpmyadmin

cp -rf phpMyAdmin-v2.11.5.2 /www/phpmyadmin

cd /www/phpmyadmin/

cp config.sample.inc.php config.inc.php

vi config.inc.php

$cfg['blowfish_secret'] = ''改为

$cfg['blowfish_secret'] = 'dd'

只要不为空就可以了,这样就可以登陆,如果还有问题,就修改一下语言就解决“配置文件现在需要绝密的短语密码(blowfish_secret)”这个错误了。

5.7 设置apache支持php

编辑httpd.conf

/usr/local/apache2/conf/httpd.conf

LoadModule php5_module modules/libphp5.so

在这一行下,添加下面两行

加上下面两行

AddType application/x-httpd-php .php .phtml

AddType application/x-httpd-php-source .phps

DirectoryIndex index.html 改为

DirectoryIndex index.html index.htm default.htm default.html index.php index.php3 index.jsp

service httpd restart

测试php

vi /www/info.php

phpinfo()

?>

5.8 由于mysql是不允许远程连接的,所以还需要设置mysql

mysql

use myaql

GRANT ALL PRIVILEGES ON *.* TO mailto:%20root%20@%20 IDENTIFIED BY '' WITH GRANT OPTION;

IDENTIFIED BY 后面是root的密码,我的密码为空。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是在 CentOS 7 上安装 Zabbix 6.0、Nginx、MySQL 8、PHP 7.4 的步骤: 1. 安装 EPEL 和 Remi 源: ``` yum install -y epel-release rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm ``` 2. 安装 Nginx: ``` yum install -y nginx systemctl start nginx systemctl enable nginx ``` 3. 安装 PHP 7.4: ``` yum install -y php74-php-fpm php74-php-mysqlnd php74-php-xmlrpc php74-php-gd php74-php-intl php74-php-mbstring php74-php-soap php74-php-xml php74-php-json php74-php-zip systemctl start php74-php-fpm systemctl enable php74-php-fpm ``` 4. 安装 MySQL 8: ``` rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm yum install -y mysql-community-server systemctl start mysqld systemctl enable mysqld ``` 5. 配置 MySQL: ``` mysql_secure_installation ``` 6. 创建 Zabbix 数据库: ``` mysql -u root -p CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost'; FLUSH PRIVILEGES; EXIT; ``` 7. 导入 Zabbix 数据库: ``` cd /usr/share/doc/zabbix-server-mysql-6.0.0/ zcat create.sql.gz | mysql -u zabbix -p zabbix ``` 8. 安装 Zabbix Server 和 Agent: ``` yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent ``` 9. 配置 Zabbix: ``` vi /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=password ``` 10. 启动 Zabbix Server 和 Agent: ``` systemctl start zabbix-server zabbix-agent systemctl enable zabbix-server zabbix-agent ``` 11. 配置 Nginx: ``` vi /etc/nginx/conf.d/zabbix.conf server { listen 80; server_name localhost; root /usr/share/zabbix; location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass unix:/run/php74-php-fpm/zabbix.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } ``` 12. 重启 Nginx: ``` systemctl restart nginx ``` 13. 打开浏览器,输入服务器 IP 地址,进入 Zabbix Web 界面,按照提示进行 Zabbix 配置即可。 注意:以上步骤仅供参考,具体操作根据实际情况进行调整。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值