知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

ubuntu12.04下编译安装lamp(apache2.2.26mysql5.5.36php5.2.17)环境

发布时间:2014-09-05 17:43:10作者:知识屋

这段时间尝试安装lamp,来做oa2013的迁移尝试,也是走了很多弯路,把其中一些记录下来,可能很乱,但是都是自己在其中遇到的一些不好解决的,以作记录备查。

使用vmware workstation 来安装ubuntu 12.04 lts版本,地址设置为192.168.131.130

安装winxp 来做oa的加密服务器,地址为192.168.131.10

创建/myoa /myoa/apache /myoa/mysql /myoa/tmp /myoa/attach /myoa/attachment /myoa/attach/cache /myoa/attach/bak /myoa/bak

首先安装公用依赖包

安装gcc make gcc-c++/g++ libxml2 libxml2-dev libjpeg62 libjpeg62-dev libjpeg-dev libpng12-dev libfreetype6-dev slapd ldap-utils libssl-dev libmysql++-dev libcurl3-openssl-dev libmhash-dev libmcrypt-dev libldap-2.4-2 libsasl2-2 libsasl2-dev libtool patch

1、安装mysql5.5.36的依赖包:

sudo apt-get install cmake bzr bison libncurses5-dev libaio1 build-essential -y 我是一个个来安装的,有基础的可以看懂。

2、解压 tar zxvf mysql-5.5.36.tar.gz

3、进入目录 cd mysql-5.5.36

3、添加mysql用户

groupadd mysql

useradd -r -g mysql mysql

更改所有权 sudo chown mysql:mysql /myoa/mysql/

4、sudo cmake -DCMAKE_INSTALL_PREFIX=/myoa/mysql -DMYSQL_UNIX_ADDR=/myoa/mysql/mysql.sock -DDEFAULT_CHARSET=gbk -DDEFAULT_COLLATION=gbk_chinese_ci -DWITH_EXTRA_CHARSETS:STRING=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/myoa/mysql/data -DWITH_DEBUG=0 -DMYSQL_TCP_PORT=3306 编译文件

5、编译安装 sudo make

sudo make install

6、sudo mkdir /etc/mysql

7、cp support-files/my-medium.cnf /etc/mysql/my.cnf

8、修改my.cnf sudo /etc/mysql/my.cnf

[mysqld]
socket = /myoa/mysql/mysql.sock
basedir = /myoa/mysql
datadir = /myoa/mysql/data
log-error = /myoa/mysql/mysql_error.log
pid-file = /myoa/mysql/mysql.pid

9、sudo cp mysql.server /etc/init.d/mysql
要给/etc/init.d/mysql一个可执行的权限
sudo chmod +x /etc/init.d/mysql
修改一下这个文件
sudo nano /etc/init.d/mysql

basedir=/myoa/mysql/ datadir=/myoa/mysql/data/10、sudo scripts/mysql_install_db --user=mysql --basedir=/myoa/mysql --datadir=/myoa/mysql/data11、sudo /etc/init.d/mysql start 启动服务 可能权限会导致出现一个错误the server quit without updating pid file 此时 执行下 sudo chmod 777 -R /myoa/mysql/
修改数据库root用户的密码 sudo /usr/local/mysql/bin/mysqladmin -u root password 'root' 12、

sudo ln -s /myoa/mysql/bin/mysqld_safe /usr/bin/

sudo ln -s /myoa/mysql/bin/mysqladmin /usr/bin/

sudo ln -s /myoa/mysql/bin/mysql /usr/bin/

13、注意 可以把win下的my.ini修改下存储路径,然后放到/etc/mysql/my.cnf 加上lower_case_table_names=1即可

13.1 设置远程连接 (根据需要设置)

sudo mysql -uroot -p 输入设置的密码

进入 执行

grant all privileges on *.* to root@"%" identified by "password" with grant option;

flush privileges;

13.2 使用远程工具恢复td_oa数据库 必须要修改完lower_case_names,且重启mysql sudo service mysql restart再导入数据库

13.3导入后修改td_oa.sys_para表中para_name中含有host的para_value为192.168.131.10即可

14、apache2.2.26的安装 sudo tar zxvf httpd2.2.26.tar.gz

sudo ./configure --prefix=/myoa/apache --enable-so --enable-mods-shared=most --with-mpm=worker

sudo make

sudo make install

sudo ln -s /myoa/apache/bin/apachectl /usr/bin/

sudo apachectl start即可启动服务

与php合并时 使用的是/etc/apache2/apache2.conf

15、php的安装

首先取得root的权限

sudo passwd

输入root的新密码

之后以root身份登录

进入php存放路径

tar zxvf php-5.5.17.tar.gz

gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1 打上fpm补丁

patch -p1 < disable_SSLv2.patch 打上SSLv2补丁 之后会提示路径输入正确的xp_ssl的路径即可

16、安装libiconv

tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13/
./configure --prefix=/usr/local
make
make install

17、设置

sudo ./configure --prefix=/myoa/php --with-config-file-path=/myoa/php/etc --with-mysql=/myoa/mysql --with-mysql-sock=/myoa/mysql/mysql.sock --with-mysqli=/myoa/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-xmlrpc --enable-zip --enable-soap --enable-ftp --with-pear --enable-exif --with-pdo-mysql --with-mssql --with-apxs2=/myoa/apache/bin/apxs

18、sudo make ZEND_EXTRA_LIBS='-liconv' 编译

19、sudo make install安装

20、复制php.ini进/myoa/php/etc/下

设置Php.ini 找到libph5.so的设置位置 修改

LoadModule modules/libphp5.so。
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

21、设置documentroot设置为/myoa/webroot

23、重启apache sudo apachectl restart

23、sduo nano /myoa/webroot/info.php

<?php

phpinfo();

?>

即可查看php是否安装成功的信息

24、安装memcache apc scws

sudo apt-get install autoconf
sudo ln -s /myoa/php/bin/phpize /usr/bin/
tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
phpize
./configure --with-php-config=/myoa/php/bin/php-config
make
make install
cd ../

tar zxvf APC-3.1.13.tgz
cd APC-3.1.13/
phpize
./configure --with-php-config=/myoa/php/bin/php-config
make
make install
cd ../

tar xvjf scws-1.2.2.tar.bz2
cd scws-1.2.2
./configure prefix=/usr/local/scws
make & make install

cd phpext

/usr/local/php/bin/phpize
./configure with-scws=/usr/local/scws with-php-config=/myoa/php/bin/php-config
make & make install
cp dict.xdb /usr/local/scws/etc
cp rules.ini /usr/local/scws/etc
chmod -R 755 /usr/local/scws/etc

sudo tar zxvf ZendOptimizer-3.3.3-linux-glibc23-i386
sudo ./install-tty
按照提示输入路径即可

vi /usr/local/php/etc/php.ini

加入下面几句:

[scws]
;
; 注意请检查 php.ini 中的 extension_dir 的设定值是否正确, 否则请将 extension_dir 设为空,
; 再把 extension = scws.so 指定绝对路径。
;
extension = scws.so
scws.default.charset = gbk
scws.default.fpath = /usr/local/scws/etc



tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/
/usr/local/webserver/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
cd ../

sudo cp /myoa/php/lib/php/extensions/no-debug-zts-20060613/* /myoa/php/ext/
或者
sudo ln -s /myoa/php/lib/php/extensions/no-debug-zts-20060613/* /myoa/php/ext/
建立一个软连接
更改php.ini
sudo nano /myoa/php/etc.php.ini
更改其中1、 include_path=".:myoa/webroot"
2、 extension_dir="/myoa/php/ext"
3、 upload_max_filesize=2048M
4、
[scws]
extension = scws.so
scws.default.charset = gbk
scws.default.fpath = /usr/local/scws/etc
[Memcache]
extension = memcache.so
memcache.allow_failover = On
memcache.max_failover_attempts = 10
memcache.chunk_size = 8192
memcache.default_port = 11211
;memcache.hash_strategy = "standard"
;memcache.hash_function = "crc32"

[apc]
extension = apc.so
apc.enabled = on
apc.shm_segments = 1
apc.shm_size = 32M
apc.user_entries_hint = 0
apc.user_ttl = 0
apc.cache_by_default = off
apc.enable_cli = off
apc.ttl = 0
apc.gc_ttl = 3600
apc.max_file_size = 1m
;apc.mmap_file_mask =
apc.num_files_hint = 0
apc.optimization = 0
apc.report_autofilter = off
apc.stat = off
apc.write_lock = off
apc.rfc1867 = off
apc.canonicalize = 0
apc.use_request_time = 0
apc.filters = ""
apc.slam_defense = off

25、wget webroot的压缩包

进入解压

修改inc/oa_config.php文件中的sql连接参数即可


(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜