首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

Ubuntu10.04筹建LAMP平台

2012-06-28 
Ubuntu10.04搭建LAMP平台?(Linux, ubuntu10.04)AMP安装过程:apt-get install cmake libncurses5-dev编译my

Ubuntu10.04搭建LAMP平台

?

(Linux, ubuntu10.04)AMP安装过程:

apt-get install cmake libncurses5-dev

编译mysql5.5.23:

?cmake . -DINSTALL_DOCDIR=/usr/local/mysql/docs -DINSTALL_MANDIR=/usr/local/mysql/manual -DINSTALL_PLUGINDIR=/usr/local/mysql/plugin -DINSTALL_SUPPORTFILEFDIR=/usr/local/mysql/extra-files -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc/my.cnf -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DENABLE_DEBUG_SYNC=0 -DENABLED_LOCAL_INFILE=1 -DENABLED_PROFILING=1 -DWITH_LIBWRAP=1 -DWITH_SSL=bundled -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_EXAMPLE_STORAGE_ENGINE=1 -DDEFAULT_COLLATION==utf8_general_ci

如果-DDEFAULT_CHARSET自己设置很容易出错。安装的时候:

./scripts/mysql_install_db --user=mysql --collation-server=utf8_general_ci

安装后在/etc/my.cnf里添加collation-server=utf8_general_ci。将innodb的设置取消注释。

?

这些也许用得着:To prevent old object files or configuration information from being used, run these commands on Unix before re-running CMake:

shell> make clean

shell> rm CMakeCache.txt

?

安装mysql服务器:

需要先安装libaio1(也不知道是什么东西)

?To install and use a MySQL binary distribution, the basic command

? ?sequence looks like this:

shell> groupadd mysql

shell> useradd -r -g mysql mysql

shell> cd /usr/local

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

shell> ln -s full-path-to-mysql-VERSION-OS mysql

shell> cd mysql

shell> chown -R mysql .

shell> chgrp -R mysql .

shell> scripts/mysql_install_db --user=mysql

shell> chown -R root .

shell> chown -R mysql data

# Next command is optional

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> bin/mysqld_safe --user=mysql &

# Next command is optional

shell> cp support-files/mysql.server /etc/init.d/mysql.server

结果如下:

root@hacker-desktop:/usr/local/mysql# scripts/mysql_install_db --user=mysql

Installing MySQL system tables...

OK

Filling help tables...

OK

?

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

?

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

?

./bin/mysqladmin -u root password 'new-password'

./bin/mysqladmin -u root -h hacker-desktop password 'new-password'

?

Alternatively you can run:

./bin/mysql_secure_installation

?

which will also give you the option of removing the test

databases and anonymous user created by default. ?This is

strongly recommended for production servers.

?

See the manual for more instructions.

?

You can start the MySQL daemon with:

cd . ; ./bin/mysqld_safe &

?

You can test the MySQL daemon with mysql-test-run.pl

cd ./mysql-test ; perl mysql-test-run.pl

?

Please report any problems with the ./bin/mysqlbug script!

按照推荐运行bin/mysql_secure_installtion,其中包括删除匿名登录用户;取消root远程登录;删除database(test),因为它是测试用的,允许远程登录;重新加载权限

?

安装后,将/usr/local/mysql/bin加入environment,将/usr/local/mysql/lib加入/etc/ld.so.conf。

?

重置mysql密码:

? ? Log on to your system as the Unix user that the mysqld server runs as (for example, mysql).

? ? Locate the .pid file that contains the server's process ID. The exact location and name of this file depend on your distribution, host name, and configuration. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. Generally, the file name has an extension of .pid and begins with eithermysqld or your system's host name.

? ? You can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the path name of the .pid file in the following command:

? ? shell> kill `cat /mysql-data-directory/host_name.pid`

? ? Use backticks (not forward quotation marks) with the cat command. These cause the output of cat to be substituted into the kill command.

? ? Create a text file containing the following statements. Replace the password with the password that you want to use.

? ? UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';

? ? FLUSH PRIVILEGES;

? ? Write the UPDATE and FLUSH statements each on a single line. The UPDATE statement resets the password for all root accounts, and the FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.

? ? Save the file. For this example, the file will be named /home/me/mysql-init. The file contains the password, so it should not be saved where it can be read by other users. If you are not logged in as mysql (the user the server runs as), make sure that the file has permissions that permit mysql to read it.

? ? Start the MySQL server with the special --init-file option:

? ? shell> mysqld_safe --init-file=/home/me/mysql-init &

? ? The server executes the contents of the file named by the --init-file option at startup, changing each root account password.

? ? After the server has started successfully, delete /home/me/mysql-init.

?

?

接下来是apache和php。先安装依赖的包:openssl, libmcrypt, mhash, libiconv, libxml2。

?

友情提示:要是有人下载zlib源码安装了,重启后可能。。。。面板出现错误。(什么原因?!!!好像根本不相关的。我的系统是ubuntu10.04)

卸载zlib,运行sudo killall gnome-panel。所以不要安装zlib,使用它的时候都使用默认路径即可。?

?

openssl: ./config threads zilb-dynamic ?make sudo make install

libmcrypt:./configure --enable-dynamic-loading

?See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

?/bin/bash ../../libtool --mode=install /usr/bin/install -c ?'xtea.la' '/usr/local/lib/libmcrypt/xtea.la'

/usr/bin/install -c .libs/xtea.so /usr/local/lib/libmcrypt/xtea.so

/usr/bin/install -c .libs/xtea.lai /usr/local/lib/libmcrypt/xtea.la

PATH="$PATH:/sbin" ldconfig -n /usr/local/lib/libmcrypt

?

Libraries have been installed in:

? ?/usr/local/lib/libmcrypt

安装mcrypt遇到问题:需要把/usr/local/lib/libmcrypt加到/etc/ld.so.conf里,然后运行:sudo ldconfig使生效

?

安装sun-java6-jre(为什么要用sunjava?):

sudo add-apt-repository "deb http://archive.canonical.com/ubuntu maverick partner"

sudo apt-get update

sudo apt-get install sun-java6-jre sun-java6-plugin

设置默认java:sudo update-alternatives --config java

JDK下载后可以直接用:

设置JAVA_HOME=/usr/local/jdk1.7.0_03

CLASSPATH=$JAVA_HOME/lib

在PATH里添加$JAVA_HOME/BIN

?

apache2.24.1:

LDFLAGS="-L /usr/local/lib/python2.6/site-packages" CPPFLAGS="-I /usr/local/include" ./configure --enable-exception-hook --enable-load-all-modules --enable-pie --enable-modules=most --enable-so --enable-file-cache --enable-cache --enable-dbd --enable-echo --enable-buffer --enable-request --enable-include --enable-reflector --enable-substitute --enable-sed --enable-charset-lite --enable-deflate --enable-mime-magic --enable-cern-meta --enable-expires --enable-usertrack --enable-unique-id --enable-remoteip --enable-proxy --enable-libmethod-byrequests --enable-session --enable-session-cookie --enable-session-dbd --enable-ssl --enable-static-support --enable-mpms-shared=all --enable-dav --enable-asis --enable-info --enable-vhost-alias --enable-negotiation --enable-imagemap --enable-actions --enable-speling --enable-userdir --enable-rewrite --with-included-apr --with-pcre=/usr/local --with-libxml2=/usr/local --with-ssl=/usr/local/ssl --with-mpm=worker

在httpd.conf里添上:ServerName localhost:80

?

建议参考:http://apache.jz123.cn/programs/configure.html

?

?

mycrypt:

LD_LIBRARY_PATH=/usr/local/lib ./configure --prefix=/usr/local/mcrypt --with-libiconv-prefix=/usr/local --with-libmcrypt-prefix=/usr/local

?

php5.4:

./configure --prefix=/usr/local/php --enable-re2c-cgoto --with-apxs2=/usr/local/apache2/bin/apxs --enable-mod-charset --with-config-file-path=/usr/local/lib --enable-libgcc --with-libxml-dir=/usr/local/libxml2 --with-openssl=/usr/local/ssl --with-pcre-regex=/usr/local --with-zlib --with-zlib-dir --with-bz2=/usr/local --enable-calendar --enable-exif --with-pcre-dir=/usr/local --enable-ftp --with-openssl-dir=/usr/local/ssl --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-mhash=/usr/local --enable-mbstring --with-mcrypt=/usr/local --with-mysql=/usr/local/mysql --with-mysql-sock --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --enable-sockets --with-iconv-dir=/usr/local --enable-zip --with-pear=/usr/local/php/pear --enable-zend-signals --enable-shmop --enable-soap --enable-mysqlnd --enable-wddx --enable-sysvmsg --enable-sysvsem --enable-sysvshm

sudo ../bin/php pyrus.phar

sudo ../bin/php go-phar.phar

?

可能需要手动修改httpd.conf添加以下信息,以使Apache和PHP合作(apache2/conf/):

AddType application/x-httpd-php .php

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

?

LoadModule PHP 5_module modules/libphp5.so

?

不过在PHP安装后自动添加了。

?

注:先将pyrus.phar拷贝至/usr/local/php/pear(指定目标,否则拷贝至源代码下的pear目录即可)。如果没有安装pear,需要用go-pear.phar解决(http://pear.php.net/go-pear.phar)

?

安装后/usr/local/lib目录下需要一份php.ini。源码目录中有两个版本可选:

?

php.ini-development 适合开发程式使用(测试用)

php.ini-production 拥有较高的安全性设定,则适合上线当产品使用

?

cp -v php.ini-{d*, p*} /usr/lib/php.ini?

一般将php.ini-production修改为php.ini,确保测试环境(本地)与正式环境(线上)一致

?

ZendStudio注册码:

34E606CF10C3E4CF202ABCEAA9B0B7A64DD2C5862A514B944AAAB38E3EB8A5F2CD735A2AB4CF9B952590EFA62BA0AB2B3E5D99C33C55309EE143165AC7F1817D626574615F3B32312F31312F323031313B392E303B3030313B313B3330

?

建立快捷方式:

[Desktop Entry]

Comment=PHP Developing

Name=ZendStudio

Exec=/usr/local/ZendStudio/ZendStudio

Encoding=UTF-8

Terminal=false

Type=Application

Categories=Application;Development

Icon=/usr/local/ZendStudio/icon.xpm

设置权限为可执行

?

Zend Studio下载后直接可用,如果你想在菜单栏里出现Eclipse的选项,可以写下面这个文件

?

$gedit ~/.local/share/applications/eclipse-user.desktop

[Desktop Entry]

Comment=PHP developer

Name=Zend Studio

Exec=/usr/local/ZendStudio/ZendStudio

Encoding=UTF-8

Terminal=false

Type=Application

Categories=Application;Development;

Icon=/usr/local/ZendStudio/icon.xpm?

?

?

可以用以下命令制作xpm图片文件:convert Icon.png Icon.xpm

?

使shell可以直接调用,建立脚本:

?

#!/bin/bash

/usr/local/ZendStudio/ZendStudio

热点排行