微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

服务器应用安装文档

服务器应用安装文档

App 服务器应用安装文档

  1. 安装依赖包
yum install gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-server readline-devel pcre-devel openssl-devel  gcc gcc-c++ gcc-g77 gd -y
  1. openresty 安装
wget http://openresty.org/download/openresty-1.11.2.2.tar.gz
wget http://nchc.dl.sourceforge.net/project/mcrypt/libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

groupadd www
useradd –g www www –s /bin/false

tar zxf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure && make && make install

tar zxf openresty-1.11.2.2.tar.gz
cd openresty-1.11.2.2
./configure --with-luajit
gmake && gmake install

vim /usr/local/openresty/Nginx/conf/Nginx.conf

/usr/local/openresty/Nginx/sbin/Nginx  -c /usr/local/openresty/Nginx/conf/Nginx.conf
  1. PHP 安装
yum install –y libjpeg-devel curl-devel bzip2-devel libxml2-devel libpng-devel freetype-devel
	
./configure --prefix=/usr/local/PHP --with-libxml-dir=/usr/include/libxml2 --with-config-file-path=/usr/local/PHP/etc/ --with-MysqL=MysqLnd --with-MysqLi=MysqLnd --with-pdo-MysqL=MysqLnd --with-gd --enable-gd-native-ttf --with-zlib --with-mcrypt --enable-shmop --enable-soap --enable-sockets --enable-wddx --enable-zip --with-xmlrpc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mbstring --with-zlib-dir --with-bz2 --with-curl --enable-exif --enable-ftp --with-jpeg-dir=/usr/lib64 --with-png-dir=/usr/lib64 --with-freetype-dir=/usr/lib64 --with-iconv --enable-xml --enable-bcmath --enable-sysvsem --enable-inline-optimization --enable-mbregex --with-openssl --enable-pcntl --with-gettext --enable-session

	make && make install
	cp PHP.ini-development /usr/local/PHP/etc/PHP.ini
	cp /usr/local/PHP/etc/PHP-fpm.conf.default /usr/local/PHP/etc/PHP-fpm.conf
	/usr/local/PHP/sbin/PHP-fpm

3.1 PHP-msgpack扩展

wget http://pecl.PHP.net/get/msgpack-0.5.6.tgz
tar zxf msgpack-0.5.6.tgz 
cd msgpack-0.5.6 
/usr/local/PHP/bin/PHPize
./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config
make && make install

vim /usr/local/PHP/etc/PHP.ini

安装完成需要重启PHP

3.2 PHP-redis 扩展

wget https://github.com/nicolasff/PHPredis/archive/2.2.4.tar.gz
tar zxf 2.2.4.tar.gz
cd PHPredis-2.2.4/
/usr/local/PHP/bin/PHPize
./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config
make && make install
vim /usr/local/PHP/etc/PHP.ini

重启PHP

  1. autoconf 安装
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
yum install libtool exp	at-devel MysqL-devel
cd autoconf-2.69
./configure --prefix=/usr
make && make install
/usr/bin/autoconf –V
  1. coressek 安装
  wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz
yum install MysqL-devel libxml2-devel expat-devel   gcc gcc-c++
tar zxf coreseek-4.1-beta.tar.gz 
cd coreseek-4.1-beta/mmseg-3.2.14/
./bootstrap
./configure --prefix=/usr/local/mmseg3
make && make install
cd ../csft-4.1
sh buildconf.sh 

./configure --prefix=/usr/local/coreseek --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-MysqL

make && make install

  cd ../testpack/
cat var/test/test.xml 
/usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc/ var/test/test.xml 
/usr/local/coreseek/bin/indexer -c etc/csft.conf --all
/usr/local/coreseek/bin/search -c etc/csft.conf 网络
ln -s /usr/local/coreseek/bin/* /usr/bin/
  1. ssdb 安装
wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip
yum install -y gcc gcc-c++ gcc-g77
unzip master
cd ssdb-master
make && make install

设置随系统启动
cp /ssdb-master/tools/ssdb.sh /etc/init.d/ssdb	
vim /etc/init.d/ssdb
	     configs="/usr/local/ssdb/ssdb.conf"
    
chkconfig —-add ssdb
chkconfig ssdb on
ln -sv /usr/local/ssdb/* /usr/bin/
/etc/init.d/ssdb start

老版本手动启动

/usr/local/ssdb/ssdb-server -d /usr/local/ssdb/ssdb.conf   参数 -d 为后台启动
  1. redis 安装
wget http://download.redis.io/releases/redis-2.8.7.tar.gz
wget http://download.redis.io/releases/redis-2.8.4.tar.gz
wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz
wget http://download.redis.io/releases/redis-2.8.13.tar.gz

tar zxf redis-3.0.3.tar.gz 
cd redis-3.0.3
make && make install
mkdir -p /usr/local/redis/{bin,etc,log,var}
mv src/mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server redis-trib.rb /usr/local/redis/bin/
cp redis.conf /usr/local/redis/etc/

修改配置文件项 daemonize为yes以使redis后台启动
启动redis,需加上配置文件地址 否则报错
vim /usr/local/redis/etc/redis.conf 

启动 redis

/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
  1. MysqL 安装
#下载MysqL源码包及编译工具cmake
wget https://cdn.MysqL.com/archives/mysql-5.6/mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz
wget http://www.cmake.org/files/v3.3/cmake-3.3.0.tar.gz
tar zxf cmake-3.3.0.tar.gz
cd cmake-3.3.0

#编译安装cmake
./configure && make && make install

#添加组及用户
groupadd MysqL
useradd –g MysqL MysqL –s /bin/false

#创建MysqL数据目录并给MysqL赋权
mkdir –p /data/MysqL/{data,tmp}
chown –R MysqL.MysqL /data/MysqL

tar zxf mysql-5.6.26.tar.gz
cd mysql-5.6.26/

#编译MysqL
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/MysqL  \
-DMysqL_DATADIR=/data/MysqL/data  \
-DSYSconfdIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMysqL_UNIX_ADDR=/var/lib/MysqL/MysqL.sock \
-DMysqL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

#安装MysqL
make && make install

#赋权
chown -R MysqL.MysqL /usr/local/MysqL

#初始化db
cd /usr/local/MysqL/scripts/
./MysqL_install_db --user=MysqL --basedir=/usr/local/MysqL/ --datadir=/data/MysqL/data

#把MysqL启动脚本移动到服务启动与管理目录
cd ../support-files/
cp MysqL.server /etc/rc.d/init.d/MysqLd

#修改MysqLd 启动指定的安装目录及数据目录
vim /etc/rc.d/init.d/MysqLd

修改
basedir=/usr/local/MysqL/
datadir=/data/MysqL/data/

#开机自启
chkconfig --add MysqLd
chkconfig --level 345 MysqLd on

#启动服务
service MysqLd start


若报错 ERROR! The server quit without updating PID file
则修改配置文件/etc/my.cnf

给root添加密码

update MysqL.user set password=PASSWORD('密码') WHERE user='root';

删除匿名用户

delete from MysqL.user where user='';

添加用户

GRANT USAGE ON *.* TO 'appwriter'@'localhost' IDENTIFIED BY 'appwr@zxcv' WITH GRANT OPTION;

赋权远程访问

GRANT ALL PRIVILEGES ON *.* TO 'appwriter'@'%' IDENTIFIED BY 'appwr@zxcv' WITH GRANT OPTION;

最大权限

grant all privileges on *.* to appwriter@localhost identified  by 'appwr@zxcv';

用户添加操作某个库的权限

 grant select,update on *.* to appwriter@localhost identified by 'appwr@zxcv';

flush privileges;

查看用户

   SELECT disTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM MysqL.user;
  1. Python-2.7、scrapy 安装
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
tar zxf Python-2.7.10.tgz 
cd Python-2.7.10
./configure --prefix=/usr/local/python2.7
make && make install
ln –s /usr/local/python2.7/bin/python /usr/bin/
python –V
yum install  libxml* libxslt-devel libffi-devel openssl*

wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-2.1.tar.gz
tar zxf setuptools-2.1.tar.gz 
cd setuptools-2.1
python setup.py build
python setup.py install

wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-1.5.tar.gz
tar zxf pip-1.5.tar.gz
cd pip-1.5
python setup.py install
ln -s /usr/local/python2.7/bin/pip /usr/bin/

wget https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.15.1.tar.gz
tar zxf pyOpenSSL-0.15.1.tar.gz 
cd pyOpenSSL-0.15.1
python setup.py install

pip install scrapy
./scrapy version
  1. python-MysqL 安装
wget http://cdn.MysqL.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip
unzip mysql-connector-python-2.0.4.zip 
cd mysql-connector-python-2.0.4
python setup.py install
  1. python-redis 安装
wget https://pypi.python.org/packages/source/r/redis/redis-2.8.0.tar.gz
tar -zvxf redis-2.8.0.tar.gz
mv redis-2.8.0 python-redis-2.8.0
cd python-redis-2.8.0
python setup.py install
  1. mongodb 安装
64位http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.5.tgz
tar zxf mongodb-linux-x86_64-2.4.5.tgz
groupadd mongo   
useradd -g mongo mongo -s /bin/nologin
mkdir -p /usr/local/mongodb/{db,logs}
cp -r mongodb-linux-x86_64-2.4.5/bin /usr/local/mongodb/

chown -R mongo:mongo /usr/local/mongodb

vim /etc/mongod.conf 添加以下内容
================================mongod.conf开始=========================
# mongo.conf
#where to log
logpath=/usr/local/mongodb/logs/mongod.log

logappend=true

# fork and run in background
fork = true

#port = 27017

dbpath=/usr/local/mongodb/db/

# location of pidfile
pidfilepath = /var/run/mongodb/mongod.pid

# disables write-ahead journaling
# nojournal = true

# Enables periodic logging of cpu utilization and I/O wait
#cpu = true

# Turn on/off security.  Off is currently the default
#noauth = true
#auth = true

# Verbose logging output.
#verbose = true

# Inspect all client data for validity on receipt (useful for
# developing drivers)
#objcheck = true

# Enable db quota management
#quota = true

# Set oplogging level where n is
#   0=off (default)
#   1=W
#   2=R
#   3=both
#   7=W+some reads
#diaglog = 0

# Ignore query hints
#nohints = true

# disable the HTTP interface (Defaults to localhost:27018).
#nohttpinterface = true

# Turns off server-side scripting.  This will result in greatly limited
# functionality
#noscripting = true

# Turns off table scans.  Any query that would do a table scan fails.
#notablescan = true

# disable data file preallocation.
#noprealloc = true

# Specify .ns file size for new databases.
# nssize = <size>

# Accout token for Mongo monitoring server.
#mms-token = <token>

# Server name for Mongo monitoring server.
#mms-name = <server-name>

# Ping interval for Mongo monitoring server.
#mms-interval = <seconds>

# Replication Options

# in replicated mongo databases, specify here whether this is a slave or master
#slave = true
#source = master.example.com
# Slave only: specify a single database to replicate
#only = master.example.com
# or
#master = true
#source = slave.example.com

=========================mongod.conf结束==========================================

vim /etc/init.d/mongod 添加mongo自启动

================================== 开始 ====================================

#!/bin/bash

# mongod - Startup script for mongod

# chkconfig: 35 85 15
# description: Mongo is a scalable, document-oriented database.
# processname: mongod
# config: /etc/mongod.conf
# pidfile: /var/run/mongo/mongod.pid

/etc/rc.d/init.d/functions

# things from mongod.conf get there by mongod reading it


# NOTE: if you change any OPTIONS here, you get what you pay for:
# this script assumes all options are in the config file.
CONfigFILE="/etc/mongod.conf"
OPTIONS=" -f $CONfigFILE"
SYSCONfig="/etc/sysconfig/mongod"

# FIXME: 1.9.x has a --shutdown flag that parses the config file and
# shuts down the correct running pid, but that's unavailable in 1.8
# for Now.  This can go away when this script stops supporting 1.8.
DBPATH=`awk -F= '/^dbpath=/{print $2}' "$CONfigFILE"`
PIDFILE=`awk -F= '/^dbpath\s=\s/{print $2}' "$CONfigFILE"`
mongod=${MONGOD-/usr/local/mongodb/bin/mongod}

MONGO_USER=mongo
MONGO_GROUP=mongo

if [ -f "$SYSCONfig" ]; then
    . "$SYSCONfig"
fi

# Handle NUMA access to cpus (SERVER-3574)
# This verifies the existence of numactl as well as testing that the command works
numactl_ARGS="--interleave=all"
if which numactl >/dev/null 2>/dev/null && numactl $numactl_ARGS ls / >/dev/null 2>/dev/null
then
    numactl="numactl $numactl_ARGS"
else
    numactl=""
fi

start()
{
  echo -n $"Starting mongod: "
  daemon --user "$MONGO_USER" $numactl $mongod $OPTIONS
  RETVAL=$?
  echo
  [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mongod
}

stop()
{
  echo -n $"Stopping mongod: "
  killproc -p "$PIDFILE" -d 300 /usr/bin/mongod
  RETVAL=$?
  echo
  [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mongod
}

restart () {
        stop
        start
}

ulimit -n 12000
RETVAL=0

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart|reload|force-reload)
    restart
    ;;
  condrestart)
    [ -f /var/lock/subsys/mongod ] && restart || :
    ;;
  status)
    status $mongod
    RETVAL=$?
    ;;
  *)
    echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
    RETVAL=1
esac

exit $RETVAL

==================================== 结束 =========================================
chmod +x /etc/init.d/mongod
chkconfig --add mongod
chkconfig --level 345 mongod on

ln -s /usr/local/mongodb/bin/* /usr/bin/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐