Install LAMP and Discuz in Redhat Linux AS4

Source: Internet
Author: User

The simplest LAMP Configuration

At first, I thought it was quite difficult to try it. Later, my friend told me to try it on a forum, so I tried it first. I wanted to learn iptables first. Now we will first learn the basic LAMP.

After reading the introduction on the Internet and what laruence has done, the installation process is basically as follows:

The software is as follows:

Mysql: mysql-4.0.21.tar.gz (the initial installation is rpm, but can not find the configuration file and the like, So I compiled it myself)

Php: php-4.4.2.tar.gz

Apache: httpd-2.2.0.tar.bz2

Discuz! _4.1.0_ SC _GBK.zip (all downloaded from the CU)

1. Install Mysql first

Mkdir/usr/local/mysql
Groupadd mysql
Useradd-g mysql
Tar-zxvf mysql4.0.21.tar.gz-C/usr/local/src
Cd/usr/local/src/mysql4.0.21
./Configure -- prefix =/usr/local/mysql -- with-charset = gbk

# Here I will see a lot of related things. Install Discuz! The gbk error will occur. Add -- with-charset = gbk.

Make

Make install

Cp support-files/my-medium.cnf/etc/my. cnf

# (This folder is in the original compiled directory) If you want to overwrite it, enter "y"

Cd/usr/local/mysql

Cd bin

./Mysql_install_db -- user = mysql

# The user here must be mysql

Chown-R root.

Chown-R mysql var

Chown-R mysql.

Bin/mysqld_safe -- user = mysql &

# Run it with a mysql user

# If there is no problem here, it should be okay. The installation is complete.

Then add mysql to start:

# This is what laruence says:

Renew the instance immediately after the device is turned on!

# Vi/etc/rc. d/rc. local

# Add the following line to the last line of the case!

Cd/usr/local/mysql;/usr/local/mysql/bin/safe_mysqld -- user = mysql &

# In this way, you can automatically activate MySQL every time you start the machine!

To specify the content:

Vi ~ /. Add bashrc

Export PATH = "$ PATH:/usr/local/mysql/bin" // Add all commands under mysqlin to the System PATH

# Add this to the System Service of setup.

Cp/usr/local/mysql/share/mysql. server/etc/rc. d/init. d/mysql // copy the mysql service startup Item file.

Chmod + x/etc/rc. d/init. d/mysql // execution permission

Useradd mysql // create a mysql user

Chown-R mysql/usr/local/mysql

Chown-R mysql/etc/rc. d/init. d/mysql // grant mysql user permissions

/Sbin/chkconfig -- del mysql

/Sbin/chkconfig -- add mysql // put mysql in the startup Item List

It should be OK here. If you try again, you can set up the database "bbs" in the next Forum. Add a password to the root user of mysql.

# Mysqladmin-u root password 123456

# Mysql-u root-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or g.

Your MySQL connection id is 476 to server version: 4.1.20-log

Type help; or h for help. Type c to clear the buffer.

Mysql> create database bbs;

You can

Mysql> show databases; three databases should appear

Ii. install Apache

Mkdir/usr/local/apache

Tar-jxvf Apache: httpd-2.2.0.tar.bz2-C/usr/local/src

./Configure -- prefix =/usr/localapache -- enable-module = most -- enable-shared = max -- enable-so

# -- Enable-so is particularly important

Make

Make install

# The Startup File is/usr/local/apache/bin/apachectl start (the same as httpd-k start)

Vi conf/httpd. conf

# Modify the default startup page

DirectoryIndex index.html index.htm default.htm default.html index. php index. php3 index. jsp

Join and start:

Set/usr/local/apache2/bin/apachectl start (I used/usr/local/apache2/bin/httpd-k start)

Put in/etc/rc. d/rc. local

# This is what laruence says:

/Etc/rc. d/rc. local add to enable mysql and apache

Cd/usr/local/mysql;/usr/local/mysql/bin/safe_mysql -- user = mysql &

/Usr/local/apache/bin/httpd-k start &

3. install PHP

Mkdir/usr/local/php4

Tar-zxvf php-4.4.2.tar.gz-C/usr/local/src

Cd/usr/local/src

./Configure -- prefix =/usr/local/php4 -- with-mysql =/usr/local/mysql -- with-apxs2 =/usr/local/apache/

Bin/apxs -- with-config-file-path =/usr/local/php4

Make

Make install

Cp php. ini-dist/usr/local/php4/php. ini

Vi/usr/local/apache/config/httpd. conf

# Start the php option in Apache and find the following two lines

LoadModule php4_module modules/libphp4.so

AddType application/x-httpd-php. php

Test PHP

Restart Apache:/usr/local/apache/bin/apachectl stop/start
Cd/usr/local/apache/htdocs
Vi test. php

Input:

<? Php
Phpinfo ();
?>

After saving the file, http: // localhost/test. php will check the result ~~~

Detailed enough.

4. Install Discuz!

Decompress the package and place the upload file under the default htdocs file. Change the permission of all files to 777, and then modify config. inc. php.

Vi/usr/local/apache/htdocs/config. inc. php

The database is set to the bbs created at the beginning, and the user is root ......

In this case, enter http: // yourdomain/install. php to start the configuration. Since gbk support was added during mysql configuration, the settings here should be fine.

Of course, you must first set up DNS and use samba when transferring files (I use samba, it should be ftp ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.