安装openlitespeed服务器&PHP7&mysql5.6服务器

  • A+
所属分类:LiteSpeed

如果是编译的话,请看下面
1、安装所需组价
参照“编译安装openLitespeed服务器所需依赖的包

2、编译可选项

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Fine tuning of the installation directories:
--bindir=DIR            user executables [EPREFIX/bin]
--sbindir=DIR           system admin executables [EPREFIX/sbin]
--libexecdir=DIR        program executables [EPREFIX/libexec]
--sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR     modifiable single-machine data [PREFIX/var]
--libdir=DIR            object code libraries [EPREFIX/lib]
--includedir=DIR        C header files [PREFIX/include]
--oldincludedir=DIR     C header files for non-gcc [/usr/include]
--datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
--datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR           info documentation [DATAROOTDIR/info]
--localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR            man documentation [DATAROOTDIR/man]
--docdir=DIR            documentation root [DATAROOTDIR/doc/openlitespeed]
--htmldir=DIR           html documentation [DOCDIR]
--dvidir=DIR            dvi documentation [DOCDIR]
--pdfdir=DIR            pdf documentation [DOCDIR]
--psdir=DIR             ps documentation [DOCDIR]

Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names

System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]

Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0")
--enable-dependency-tracking
do not reject slow dependency extractors
--disable-dependency-tracking
speeds up one-time build
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-assert turn off assertions
--enable-adminssl=[yes/no]
Enable HTTPS for admin console (modify adminssl.conf
before installation) [default=yes]
--enable-spdy=[yes/no] Enable SPDY and http2 over HTTPS [default=yes]
--enable-http2=[yes/no] Enable SPDY and http2 over HTTPS [default=yes]
--enable-redis Enable redis for cache module (Using redis is
disabled by default)
--enable-debug Enable debugging symbols (Debug is disabled by
default)
--enable-profiling Enable cpu profiling (profiling is disabled by
default)
--disable-rpath Disable rpath (It is 'no' by default)

Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot=DIR Search for dependent libraries within DIR
(or the compiler's sysroot if not specified).
--with-user Set user name to run openlitespeed [default: nobody]
--with-group Set group of the user [default: nobody]
--with-admin Set administrator user name [default: admin]
--with-password Set password of administrator [default: 123456]
--with-email Set email of administrator [default: root@localhost]
--with-lua[=DIR] use liblua (located in directory DIR, if supplied) for compiling mod_lua module. [default=no]
--with-libdir Set system lib directory. It is lib or lib64 and
will be automatically checked by default
--with-zlib=DIR root directory path of zlib installation defaults to
/usr/local or /usr if not found in /usr/local
--without-zlib to disable zlib usage completely
--with-openssl=DIR root of the OpenSSL directory
--with-pcre[=prefix] compile xmlpcre part (via libpcre check)
--with-expat=[ARG] use Expat XML Parser from given prefix (ARG=path);
check standard prefixes (ARG=yes); disable (ARG=no)
--with-expat-inc=[DIR] path to Expat XML Parser headers
--with-expat-lib=[ARG] link options for Expat XML Parser libraries

Some influential environment variables:
CXX C++ compiler command
CXXFLAGS C++ compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if
you have headers in a nonstandard directory
CC C compiler command
CFLAGS C compiler flags
CPP C preprocessor
CXXCPP C++ preprocessor

自行选择编译参数或者按默认来
注意,Google gcc默认的用户编译会出错,su成root权限要求密码。。可这个密码是哪儿来的呢?
首先应设置root用户密码
sudo passwd root
设置好root密码后再
su root
将当前用户su成root权限用户
编译顺利完成

编译好后并不能通过浏览器访问默认端口8088 7080的示例页面及管理页面
原因创建计算单元的时候默认的端口规则(相当于iptable规则)未开放以上两个端口访问
需要在网络选项下添加规则如下:

1
allow-openlitespeed-default-port

說明

允许openLitespeed初始默认的端口8088 允许openLitespeed初始默认的端口7080
網路

default
來源篩選器

允許任何來源的流量 (0.0.0.0/0)
允許的通訊協定和通訊埠

tcp:8088
tcp:7080

好了,可以进入后台,配置服务器了
配置另讲,这里是配置文件,可以直接下载使用????????????待我补充???????????????

新建一个listener监听80端口并命名为web

新建虚拟主机配置模板Virtual Host Template命名为php-web
ssh客户端手动建立配置文件

1
vi /usr/local/lsws/conf/templates/php-web.conf;chmod 777 /usr/local/lsws/conf/templates/php-web.conf

管理后台面板建立虚拟主机模板
命名Template Name:php-web
配置文件Template File:$SERVER_ROOT/conf/templates/php-web.conf
配置监听端口Mapped Listeners:web
保存重启服务器

新建虚拟主机。。。。
ssh手动建立目录

1
2
cd /;mkdir /wwwroot;chmod 755 /wwwroot;mkdir /wwwroot/html;chmod 755 /wwwroot/html;
touch /usr/local/lsws/conf/vhosts/xxxx.conf;chmod 777 /usr/local/lsws/conf/vhosts/xxxx.conf

后台设置
根目录$SERVER_ROOT/wwwroot/html/$VH_NAME
配置文件位置$SERVER_ROOT/conf/vhosts/$VH_NAME.conf

然后在 Listener web > General 下添加刚才的主机绑定域名

------------------------------------------------------------------------------------------------------------
rpm源安装php7
先安装依赖包等
yum install epel-release
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el6.noarch.rpm
yum search lsphp70
yum install lsphp70 lsphp70-common lsphp70-gd lsphp70-process lsphp70-mbstring lsphp70-mysqlnd lsphp70-xml lsphp70-mcrypt lsphp70-pdo lsphp70-imap

其中RPMs install lsphp70 to a default directory(/usr/local/lsws/lsphp70/) and the binary file is located in (/usr/local/lsws/lsphp70/bin/lsphp).

接着去服务器管理后台配置php7
Server Configuration > External App 添加一个 LiteSpeed SAPI App
填入以下信息(主要信息如下,其他的看情况设置)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Name: lsphp70
Address:uds://tmp/lshttpd/lsphp70.sock
Max Connections: 35
Environment: PHP_LSAPI_MAX_REQUESTS=500
PHP_LSAPI_CHILDREN=35
Initial Request Timeout (secs): 60
Retry Timeout : 0
Response Buffering: no
Auto Start: yes
Command: $SERVER_ROOT/lsphp70/bin/lsphp
Back Log: 100
Instances: 1
Memory Soft Limit (bytes): 2047M
Memory Hard Limit (bytes):2047M
Process Soft Limit: 400
Process Hard Limit: 500

保存,重启服务器

接下来
去这里 WebAdmin console > Server > Script Handler
编辑“suffix”php修改Handler Name为lsphp70
保存重启

php7配置文件位置
/usr/local/lsws/lsphp70/etc/php.ini

如果要编译安装php7,做web sever建议编译参数如下

1
--with-litespeed --enable-fpm --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pear --enable-libgcc --with-zlib --with-gd --enable-gd-native-ttf --enable-shmop --enable-sockets --enable-sysvsem --enable-sysvshm --enable-mbstring --enable-soap --with-iconv --enable-xml --with-openssl --with-mcrypt --with-xmlrpc  --with-bz2 --enable-zip --with-curl --with-png-dir --with-jpeg-dir --with-freetype-dir --disable-ipv6 --disable-rpath --disable-short-tags --without-sqlite3 --without-imap --enable-session

-------------------------------------------------------------------------------------------------------------
编译安装mysql5.6

安装编译工具和库

1
yum install gcc gcc-c++ ncurses-devel perl

安装cmake,从http://www.cmake.org下载源码并编译安装

1
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz;tar -xzvf cmake-2.8.10.2.tar.gz;cd cmake-2.8.10.2;./bootstrap ; make ; make install;cd ~

新增用户组及用户

1
groupadd mysql;useradd -r -g mysql mysql

建立安装位置及存放数据位置

1
mkdir -p /usr/local/mysql;mkdir -p /usr/local/mysql/mysqldb

下载并编译安装mysql

1
wget http://www.kakapart.com/files/mysql-5.6.16.tar.gz;tar -zxv -f mysql-5.6.16.tar.gz;cd mysql-5.6.16

cmake编译

1
cmake

参数如下

1
2
3
4
5
6
7
8
9
10
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DMYSQL_DATADIR=/usr/local/mysql/mysqldb
-DMYSQL_TCP_PORT=3306
-DENABLE_DOWNLOADS=1

关于参数问题
-DCMAKE_INSTALL_PREFIX=dir_name
设置mysql安装目录
-DMYSQL_UNIX_ADDR=file_name
设置监听套接字路径,这必须是一个绝对路径名。默认为/tmp/mysql.sock
-DDEFAULT_CHARSET=charset_name
设置服务器的字符集,缺省情况下,MySQL使用latin1的(CP1252西欧)字符集。cmake/character_sets.cmake文件包含允许的字符集名称列表。
-DDEFAULT_COLLATION=collation_name
设置服务器的排序规则。
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1
以上几个是存储引擎选项:MyISAM,MERGE,MEMORY,和CSV引擎是默认编译到服务器中,并不需要明确地安装。
静态编译一个存储引擎到服务器,使用-DWITH_engine_STORAGE_ENGINE= 1
可用的存储引擎值有:ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE (InnoDB), PARTITION (partitioning support), 和PERFSCHEMA (Performance Schema)

-DMYSQL_DATADIR=dir_name
设置mysql数据库文件目录
-DMYSQL_TCP_PORT=port_num
设置mysql服务器监听端口,默认为3306
-DENABLE_DOWNLOADS=bool
是否要下载可选的文件。例如,启用此选项(设置为1),cmake将下载谷歌所使用的测试套件运行单元测试。

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: