由於小新是非常容易健忘的人,很多東西如果沒有做個紀錄,很快就會被我遺忘,為了避免以後慘劇發生,所以我還是把先前建站的流程稍微紀錄一下,免的以後後悔~~
閱讀全文..
MySQL 安裝筆記
首先下載MySQL tarball檔案,這裡是使用mysql-5.0.22.tar.gz
將檔案解壓縮到 /usr/local/src/ 下面
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> tar -jxvf mysql-5.0.22.tar.gz
shell> cd /usr/local/src/mysql-5.0.22/
shell> CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
-felide-constructors -fno-exceptions -fno-rtti" ./configure \
--prefix=/usr/local/mysql --enable-assembler \
--with-mysqld-ldflags=-all-static \
--with-charset=utf8 \
--with-extra-charsets=all \
--with-big-tables \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-thread-safe-client
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
預設 root 是沒有密碼的,要修改 root 密碼,可以用下面的方式進行設定,以下的 mypwd 是新的密碼,請自行修改:
shell> ./bin/mysql -u root
mysql> UPDATE mysql.user SET Password=PASSWORD('mypwd') WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
設定開機自動啟動
shell> cd /usr/local/src/mysql-5.0.22/
shell> cp support-files/mysql.server /etc/init.d/mysql
shell> chmod +x /etc/init.d/mysql
Older Red Hat systems use the /etc/rc.d/init.d directory rather than /etc/init.d. Adjust the preceding commands accordingly. Alternatively, first create /etc/init.d as a symbolic link that points to /etc/rc.d/init.d:
shell> cd /etc
shell> ln -s rc.d/init.d .
在我這邊的環境裡,這連結已經做好了,所以不需要進行!
After installing the script, the commands needed to activate it to run at system startup depend on your operating system. On Linux, you can use chkconfig:
shell> chkconfig --add mysql
以下作參考用,我並沒有進行下面的設定!
On some Linux systems, the following command also seems to be necessary to fully enable the mysql script:
shell> chkconfig --level 345 mysql on
On FreeBSD, startup scripts generally should go in /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in this directory are executed only if their basename matches the *.sh shell filename pattern. Any other files or directories present within the directory are silently ignored. In other words, on FreeBSD, you should install the mysql.server script as /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup.
As an alternative to the preceding setup, some operating systems also use /etc/rc.local or /etc/init.d/boot.local to start additional services on startup. To start up MySQL using this method, you could append a command like the one following to the appropriate startup file:
/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
7. 進階設定內容:
# 由於我們 MySQL 放置的地點在 /usr/local/mysql 內,這個目錄並不在 PATH 當中!
# 且 man page 亦不在 MANPATH 裡面,所以,我們要手動的幫他加入囉!
[root@test mysql]# vi /etc/profile
# 大約在 33 行的地方,而且每個 distribution 設定的地方都不太相同!
# 請找到 export PATH ... 那一行,以 Mandrake 9.0 來說,大概在 33 行左右,
# 新加入一行:
PATH="$PATH":/usr/local/mysql/bin
export PATH ....(略)....
[root@test mysql]# vi /etc/man.config( 有的 distribution 為 /etc/man.conf )
# 可以在這個檔案的任何地方加入底下這一行:
MANPATH /usr/local/mysql/man
# 就可以具有 man page 的能力了!
參考資料:
http://dev.mysql.com/doc/refman/5.0/en/quick-install.html
http://dev.mysql.com/doc/refman/5.0/en/configure-options.html
http://dev.mysql.com/doc/refman/5.0/en/automatic-start.html
將檔案解壓縮到 /usr/local/src/ 下面
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> tar -jxvf mysql-5.0.22.tar.gz
shell> cd /usr/local/src/mysql-5.0.22/
shell> CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
-felide-constructors -fno-exceptions -fno-rtti" ./configure \
--prefix=/usr/local/mysql --enable-assembler \
--with-mysqld-ldflags=-all-static \
--with-charset=utf8 \
--with-extra-charsets=all \
--with-big-tables \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-thread-safe-client
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
預設 root 是沒有密碼的,要修改 root 密碼,可以用下面的方式進行設定,以下的 mypwd 是新的密碼,請自行修改:
shell> ./bin/mysql -u root
mysql> UPDATE mysql.user SET Password=PASSWORD('mypwd') WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
設定開機自動啟動
shell> cd /usr/local/src/mysql-5.0.22/
shell> cp support-files/mysql.server /etc/init.d/mysql
shell> chmod +x /etc/init.d/mysql
Older Red Hat systems use the /etc/rc.d/init.d directory rather than /etc/init.d. Adjust the preceding commands accordingly. Alternatively, first create /etc/init.d as a symbolic link that points to /etc/rc.d/init.d:
shell> cd /etc
shell> ln -s rc.d/init.d .
在我這邊的環境裡,這連結已經做好了,所以不需要進行!
After installing the script, the commands needed to activate it to run at system startup depend on your operating system. On Linux, you can use chkconfig:
shell> chkconfig --add mysql
以下作參考用,我並沒有進行下面的設定!
On some Linux systems, the following command also seems to be necessary to fully enable the mysql script:
shell> chkconfig --level 345 mysql on
On FreeBSD, startup scripts generally should go in /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in this directory are executed only if their basename matches the *.sh shell filename pattern. Any other files or directories present within the directory are silently ignored. In other words, on FreeBSD, you should install the mysql.server script as /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup.
As an alternative to the preceding setup, some operating systems also use /etc/rc.local or /etc/init.d/boot.local to start additional services on startup. To start up MySQL using this method, you could append a command like the one following to the appropriate startup file:
/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
7. 進階設定內容:
# 由於我們 MySQL 放置的地點在 /usr/local/mysql 內,這個目錄並不在 PATH 當中!
# 且 man page 亦不在 MANPATH 裡面,所以,我們要手動的幫他加入囉!
[root@test mysql]# vi /etc/profile
# 大約在 33 行的地方,而且每個 distribution 設定的地方都不太相同!
# 請找到 export PATH ... 那一行,以 Mandrake 9.0 來說,大概在 33 行左右,
# 新加入一行:
PATH="$PATH":/usr/local/mysql/bin
export PATH ....(略)....
[root@test mysql]# vi /etc/man.config( 有的 distribution 為 /etc/man.conf )
# 可以在這個檔案的任何地方加入底下這一行:
MANPATH /usr/local/mysql/man
# 就可以具有 man page 的能力了!
參考資料:
http://dev.mysql.com/doc/refman/5.0/en/quick-install.html
http://dev.mysql.com/doc/refman/5.0/en/configure-options.html
http://dev.mysql.com/doc/refman/5.0/en/automatic-start.html
Apache 安裝筆記
shell> ./configure --enable-so \
--enable-rewrite \
--enable-mods-shared=all
make
make install
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
/etc/init.d/httpd start
而那個 apachectl 檔案,就是啟動的 scripts 啦!若要開機時啟動 apache ,
那麼將 /etc/init.d/httpd start 放在 /etc/rc.d/rc.local 內吧
再來編輯設定檔
joe /usr/local/apache2/conf/extra/httpd-languages.conf
把
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
變更為
LanguagePriority zh-TW en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN
--enable-rewrite \
--enable-mods-shared=all
make
make install
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
/etc/init.d/httpd start
而那個 apachectl 檔案,就是啟動的 scripts 啦!若要開機時啟動 apache ,
那麼將 /etc/init.d/httpd start 放在 /etc/rc.d/rc.local 內吧
再來編輯設定檔
joe /usr/local/apache2/conf/extra/httpd-languages.conf
把
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
變更為
LanguagePriority zh-TW en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN
PHP安裝筆記
首先確定以下套件均已安裝
libjpeg-devel
libpng-devel
freetype-devel
fontconfig-devel
imap-devel
如果都有安裝了,開始準備編譯
shell> ./configure \
--prefix=/usr/local/php4 \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/usr/local/php4 \
--with-freetype-dir=/usr \
--with-gd \
--with-gdbm \
--with-gettext \
--with-iconv \
--with-imap \
--with-imap-ssl \
--with-jpeg-dir=/usr \
--with-kerberos \
--with-libxml-dir=/usr \
--with-mysql=/usr/local/mysql \
--with-png \
--with-ttf \
--with-xml \
--with-zlib \
--enable-calendar \
--enable-ftp \
--enable-gd-native-ttf \
--enable-mbstring
--with-java \ << 好像缺少相關的lib,暫時不用此參數安裝
shell> make
shell> make install
shell> cp php.ini-dist /usr/local/php4/php.ini
編輯Apache設定檔
shell> joe /usr/local/apache2/conf/httpd.conf
尋找
在此範圍添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
重新啟動Apache,大功告成!
參考資料:
http://www.5ilinux.com/lamp01.html
http://www.phpdc.com/article/7/
http://neuro.ohbi.net/linux/jmwang_mysql_php_apache.htm
libjpeg-devel
libpng-devel
freetype-devel
fontconfig-devel
imap-devel
如果都有安裝了,開始準備編譯
shell> ./configure \
--prefix=/usr/local/php4 \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/usr/local/php4 \
--with-freetype-dir=/usr \
--with-gd \
--with-gdbm \
--with-gettext \
--with-iconv \
--with-imap \
--with-imap-ssl \
--with-jpeg-dir=/usr \
--with-kerberos \
--with-libxml-dir=/usr \
--with-mysql=/usr/local/mysql \
--with-png \
--with-ttf \
--with-xml \
--with-zlib \
--enable-calendar \
--enable-ftp \
--enable-gd-native-ttf \
--enable-mbstring
--with-java \ << 好像缺少相關的lib,暫時不用此參數安裝
shell> make
shell> make install
shell> cp php.ini-dist /usr/local/php4/php.ini
編輯Apache設定檔
shell> joe /usr/local/apache2/conf/httpd.conf
尋找
在此範圍添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
重新啟動Apache,大功告成!
參考資料:
http://www.5ilinux.com/lamp01.html
http://www.phpdc.com/article/7/
http://neuro.ohbi.net/linux/jmwang_mysql_php_apache.htm
其它安裝:
GD
shell> ./configure \
--prefix=/usr/local/gd \
--with-libiconv-prefix=/usr/local/libiconv \
--with-png=/usr/lib \
--with-freetype=/usr/lib \
--with-fontconfig=/usr/lib \
--with-jpeg=/usr/lib
shell> make
shell> make install
參考資料:
http://www.boutell.com/gd/
http://www.e-gineer.com/v1/instructions/install-gd13-for-php-with-apache-on-linux.htm
--prefix=/usr/local/gd \
--with-libiconv-prefix=/usr/local/libiconv \
--with-png=/usr/lib \
--with-freetype=/usr/lib \
--with-fontconfig=/usr/lib \
--with-jpeg=/usr/lib
shell> make
shell> make install
參考資料:
http://www.boutell.com/gd/
http://www.e-gineer.com/v1/instructions/install-gd13-for-php-with-apache-on-linux.htm
發表於 楓