Install discuzx2 in Ubuntu

Source: Internet
Author: User
Tags php development environment

Http://blog.csdn.net/kevin_ysu/article/details/7452938

1. install Apache
Apache, as a powerful web program, is naturally the first choice for Building Web servers. Now, we will install Apache. Enter the following command on the terminal:
Sudo apt-Get install apache2

After the installation is complete, start Apache.
Sudo/etc/init. d/apache2 restart

Enter http: // localhost or http: // 127.0.0.1 in the browser. If "It works!" is displayed! ", It means that Apache is successfully installed. By default, Apache will create a directory named WWW under/var, which is the web directory, all web files that can be accessed through a browser must be placed in this directory.

Ii. PHP installation
Installing software in Ubuntu is a very simple task. You only need one command. Execute the following command on the terminal:
Sudo apt-Get install libapache2-mod-php5 PhP5

After installation, restart Apache to load the PHP module:
Sudo/etc/init. d/apache2 restart

Next, we will create a PHP file under the web directory to test whether PHP can run normally. command:
Sudo gedit/var/www/phpinfo. php

Compile a PHP file, for example

<HTML>

<Head>

<Title>

My first PHP page

</Title>

<Body>

Hi word </BR>

<? PHP bloginfo ();?>

</Body>

</Head>

</Html>

3. (1) install MySQL server. Here we only need to install MySQL server.

Sudo apt-Get install mysql-Server

At the end of the installation, it will ask for the root password. Note that the root password here is not the Ubuntu root password. It is the root password you want to set for MySQL. Of course, if you are happy, you can set it to the same way. Because it is mainly used for local testing, MySQL is installed here. If it is used as a server, you may need to refer to other settings.

(2) install clientapt-Get install mysql-client (3) install MySQL C language development interface apt-Get install libmysqlclient15-dev

1). MySQL installation layout in Ubuntu:

/Usr/bin client program and mysql_install_db
/DB database and log files
/Var/run mysqld Server
/Etc/MySQL configuration file my. CNF
/Usr/share/MySQL Character Set, baseline program and error message
/Etc/init. d/MySQL start MySQL Server

2). Set the MySQL server to automatically start and close with the on/off server:

System> System Management> Service
After entering the "service settings" window, activate the MySQL database service.

3) modify the storage directory of MySQL database files:

Assume that the specified database file directory is/DB.
1. Create a directory/DB and change its owner and group to MySQL: mysql. Command: chown MYSQL: MySQL db
2. Disable MySQL Database Service: mysqladmin-u root-P Shutdown
3. Modify MySQL configuration file my. CNF: Change datadir =/var/lib/MySQL to datadir =/DB
4. reinitialize the data file: Execute mysql_install_db
5. Start MySQL Database Service: sudo/etc/init. d/MySQL start
6. Set the MySQL Database Root Password: mysqladmin-u Root Password 'new-password'
At this time, we will find mysql-related files in the/DB directory. If we create a new database, its database files will also appear in the DB directory. Indicates that the file storage directory of the MySQL database we modified is correct.

4) configure the InnoDB Storage engine of the MySQL database:

1. view the MySQL storage engine: log on to the MySQL database and run the show engines command at the mysql> prompt. Conclusion: InnoDB | Yes indicates that the MySQL database server supports the InnoDB engine.
2. Set InnoDB as the default engine: Add default-storage-engine = InnoDB under [mysqld] in the configuration file my. CNF and save the statement.
3. Restart the MySQL server: mysqladmin-u root-P Shutdown (Press ENTER), sudo/etc/init. d/MySQL start (Press ENTER ).
4. log on to the MySQL database and run the show engines command at the mysql> prompt. If InnoDB | default is displayed, InnoDB is successfully set as the default engine.
PS: Here I use the restart command sudo/etc/init. d/MySQL restart, and an error message is displayed, so I used the stupid method of closing and starting the service (step 3) above.

It is said that the following command can be used once:
Sudo apt-Get install apache2 mysql-server PhP5 php5-mysql phpMyAdmin

Remember the MySQL password in this step.
In addition, you can install MySQL on the graphic management interface:
Sudo apt-Get install mysql-Admin *

If the mysql_connect () connection error occurs after the installation is successful, run the following command:

Sudo apt-Get install php5-mysql

4. Download The discuz installation package
$ Cd ~
$ Mkdir discuz
$ CD discuz
$ Wget http://download.comsenz.com/Discuz/7.2/Discuz_7.2_FULL_ SC _GBK.zip

4. decompress the package
$ Sudo apt-Get install unzip
$ Unzip discuz_7.0.0_full_ SC _gbk.zip

5. Create a BBS directory under/var/WWW and copy all the files under the previously decompressed upload directory to the BBS directory.
$ CD/var/www/
$ Sudo mkdir BBS
$ Cd ~
$ CD discuz/
$ Sudo CP-A upload/*/var/www/BBS/

6. Set the WWW folder 777 attribute in var.
$ Sudo chmod-r 777/var/WWW

7. Open the browser and enter:
Http: // server IP Address/BBS/install/index. php
Note: If the page cannot be opened, restart Apache.
$ Sudo/etc/init. d/apache2 restart




Build a php development environment in Ubuntu

In fact, I don't know anything about PhP, but when I recently browsed others' blogs, I accidentally found a blog platform-Wordpress. At the beginning, I don't know what this is. I later learned about it after Google, so I also want to try it, but WordPress is developed in PHP, my computer does not have such an environment, and I have never learned PHP, but this cannot prevent my enthusiasm. So I found some materials and set up the environment, at the beginning, I still had some detours, but it was finally set up. In fact, the method is also very simple. below is my step:
Install apache2
Enter
Sudo apt-Get install apache2
Then, wait until the installation is complete. After the installation is successful, the apache service is enabled.
Sudo service apache2 [Start | stop | restart]
To start, shut down, and restart the service.
In this case, you can enter localhost/in the browser. If the installation is successful, it works


2. install PHP


Enter
Sudo apt-Get install PhP5 libapache2-mod-php5
Now Apache can parse PHP. You can test whether it is successful and run
Sudo gedit/var/www/testphp. php
Write <? PHP phpinfo () ;?>, Then open http: // localhost/testphp. php In the browser. If it can be parsed, the output will be displayed.
I have always encountered problems here. Instead of using testphp. php, I downloaded the file directly. If you encounter this problem, try
Sudo a2enmod PhP5
The next step is to clear the browser cache and restart the apache service (I didn't restart it). I solve this problem through this method.


3. Install MySQL


Enter
Sudo apt-Get install mysql-server mysql-Client # You will be asked to enter the root user password once in the middle
Sudo apt-Get install php5-mysql # installation php5-mysql is to connect PHP and MySQL
Sudo apt-Get install libapache2-mod-auth-mysql


The installation is successful.
The following command is used to enable and disable MYSQL:
Sudo start MySQL # Start it manually
Sudo stop MySQL # manually stop
Pgrep mysqld # Check whether MySQL is enabled


Conclusion: the above steps allow you to successfully build a php development environment. At first, I set it up in windows and thought it was quite troublesome. so I thought I was using ubuntu. Why did I install it in Ubuntu? So I tried it, and succeeded. Needless to say, building on Ubuntu is indeed much easier than building on Windows. Of course, this is just to build the environment. It is easy to configure Apache and set service security.

Install discuzx2 in Ubuntu

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.