Centos 安装常用软件

来源:互联网 发布:cda数据分析一级好考吗 编辑:程序博客网 时间:2024/06/05 04:34

以前没安装过软件,试过一次才知道


安装MySQL。
[root@sample ~]# yum -y install mysql-server  ← 安装MySQL


配置MySQL
[root@sample ~]#vim /etc/my.cnf  ← 编辑MySQL的配置文件
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1  ← 找到这一行,在这一行的下面添加新的规则,让MySQL的默认编码为UTF-8
default-character-set = utf8  ← 添加这一行
然后在配置文件的文尾填加如下语句:
[mysql]
default-character-set = utf8


启动MySQL服务
[root@sample ~]# chkconfig mysqld on  ← 设置MySQL服务随系统启动自启动
[root@sample ~]# chkconfig --list mysqld  ← 确认MySQL自启动 
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off  ← 如果2--5为on的状态就OK
[root@sample ~]#/etc/rc.d/init.d/mysqld start  ← 启动MySQL服



安装redis

redis 官方网站 http://redis.io/


$ wget http://redis.googlecode.com/files/redis-2.6.9.tar.gz
$ tar xzf redis-2.6.9.tar.gz
$ cd redis-2.6.9
$ make; make install

vi redis.conf
daemon no -> daemon yes
cp redis.conf /etc/

cd ~
redis-server /etc/redis.conf

开机自启动
echo "redis-server /etc/redis.conf" >>/etc/rc.d/rc.local


安装php
yum install php


安装php 连接redis的包
yum list | grep php | grep redis
yum install -y php-redis.x86_64




#redis-py 安装
#1:git clone  https://github.com/andymccurdy/redis-py
#2:cd redis-py
#3:python setup.py install
import redis


#yum install MySQL-python  MySQLdb安装
import MySQLdb


wgethttp://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f

tar zvxf  MySQL-python-1.2.3.tar.gz

cd MySQL-python-1.2.3

python setup.py build

sudo python setup.py install




1.     安装php memcache扩展

yum install php-pecl-memcache

 

 

redhat:

pecl install memcache

 

 

 

php memcache 命令行安装的方法

 

wget http://pecl.php.net/get/memcache-3.0.6.tgz

 

phpize&& ./configure --enable-memcache && make

 

cpmodules/memcache.so /usr/lib/php/modules/

 

zlib没有找到的解决办法

configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and

library are located

 

yum install zlib-devel