Linux operating system under the Web server configuration detailed introduction _linux

Source: Internet
Author: User
Tags mysql client create database
The software is in the/home/web directory.
1.MYSQL Configuration process:
[Root@mail web]# tar zxvf mysql-5.0.18.tar.gz
[Root@mail web]# CD mysql-5.0.18
[Root@mail mysql-5.0.18]# Groupadd MySQL
[Root@mail mysql-5.0.18]# useradd-g MySQL MySQL
[Root@mail mysql-5.0.18]#./configure--prefix=/usr/local/mysql #把MYSQL安装到指定目录
[Root@mail mysql-5.0.18]# make
[Root@mail mysql-5.0.18]# make install
[Root@mail mysql-5.0.18]# scripts/mysql_install_db
[Root@mail mysql-5.0.18]# chown-r Root/usr/local/mysql
[Root@mail mysql-5.0.18]# chown-r Mysql/usr/local/mysql/var
[Root@mail mysql-5.0.18]# chgrp-r Mysql/usr/local/mysql
[Root@mail mysql-5.0.18]# CP support-files/my-medium.cnf/etc/my.cnf
Start the MySQL database with the following command (if the operating system defaults to a MySQL database installed, make sure it's not started):
[Root@mail mysql-5.0.18]#/usr/local/mysql/bin/safe_mysqld--user=mysql &
Append the above startup command to the end of the file "/etc/rc.d/rc.local", which automatically MySQL database server when the operating system starts. The following are initialization settings for MySQL: [Root@mail mysql-5.0.18]#/usr/local/mysql/bin/mysql into the MySQL client tool for related settings
Mysql>drop database test;
Mysql>use MySQL;
Mysql>delete from MySQL where user= "";
Mysql>delete from MySQL where host= "%";
Mysql>delete from DB;
Now the MySQL database will only allow the local MySQL administrator root user (different from the operating system root), and use the following command to specify a password for the root user:
[Root@mail mysql-5.0.18]# Cd/usr/local/mysql/bin
[Root@mail bin]#./mysqladmin-u root@localhost Password "123456"
where "123456" is the root user password. According to your own situation, set up a new database below
[Root@mail bin]#./mysql-u root-p
Mysql>create database Linux;
Mysql>grant all privileges on linux.* to Linux@localhost identfied by ' Linux ';
mysql>exit;
[Root@mail bin]#./mysqladmin-u root@localhost-p flush-privileges;
The above command creates the MyDB database and assigns all of its permissions to Linux users, the password is "Linux" and can only log on to the database from the local computer.
2.Apache and PHP configuration process:
[Root@mail web]# tar zxvf httpd-2.0.50.tar.gz
[Root@mail web]# CD httpd-2.0.50
[Root@mail web]# CD httpd-2.0.50
[Root@mail httpd-2.0.50]#./configure--prefix=/usr/local/apache2--enable-module=so
[Root@mail httpd-2.0.50]# make
[Root@mail httpd-2.0.50]# make install
[Root@mail httpd-2.0.50]# CD ...
[Root@mail web]# tar zxvf php-5.0.0.tar.gz #安装配置PHP
[Root@mail web]# tar zxvf php-5.0.0.tar.gz
[Root@mail web]# CD php-5.0.0
[Root@mail php-5.0.0]#./configure--enable-track-vars--with-mysql=/usr/local/mysql--with-apxs2=/usr/local/ Apache2/bin/apxs--disable-libxml--disable-dom--disable-******lxml--enable-soap--enable-xml
#因为装的Apache是比较高的版本, so--with-apx this to--WITH-APXS2, and PHP5 added a lot of extended features, so be sure to add, or it will be an error.
[Root@mail php-5.0.0]# make
[Root@mail php-5.0.0]# make install
[Root@mail php-5.0.0]# cp php.ini-dist/usr/local/lib/php.ini #拷贝这个文件到/usr/loca/lib/directory and renamed to PHP.ini
The following job is to modify the Apache configuration file
[Root@mail php-5.0.0]# vi/usr/local/apache2/conf/httpd.conf
Add this sentence: AddType application/x-httpd-php. php
and change the Directotyindex index.html Index.html.var to
DirectoryIndex index.php index.html index.htm
Edit the "/usr/local/lib/php.ini" file. Change off to On
Register_globals=on
Start the Web server with the following command, add it to the "/etc/rc.d/init.d/rc.local" file so that it starts automatically with the boot.
[Root@mail php-5.0.0]#/usr/local/apache2/bin/apachectl start
You can create test.php files under the directory "/usr/local/apache/htdocs/" for system testing.
Phpinfo ();
?>
In the browser input http://your_ip/test.php (your_ip as the server's IP address), you can see the basic configuration of PHP information, and have a MySQL database related support information, if not seen, the configuration has problems, need to check the above steps.
In order to take advantage of the rich application software in the Windows platform, we will use the Samba server and the Windows host to communicate in Linux, the webpage and the related PHP program files are stored directly on the Linux server after the development of Windows. No need to use FTP and other tools to upload.
First, verify that the current Linux operating system has the Samba software package installed, and continue with the following steps if it is not installed.
Edit Samba's configuration file "/etc/samba/smb.conf" and add the following at the end:
Copy Code code as follows:

[Linux]
Path =/home/linux
valid = user PHP
public = No
writable = yes
printable = no
creat mask = 0755

Use the following command to add system users and Samba users:
[Root@mail web]# adduser PHP
[Root@mail web]# Smbadduser php:php
(You need to enter a samba password to use when you log on to the Samba server in Windows)
[Root@mail web]#/etc/rc.d/init.d/smb start #启动SMB
Use the following command to start the Samba server automatically on each boot:
[Root@localhost root]# chkconfig--level 3 SMB on
In Windows Client (recommended to use nt/2000) use the IP address of the server "search computer", after found, double-click the computer icon, in the pop-up dialog box in the User column input "PHP", Password box to enter the use of the "Smbadduser" command to set the samba password, and then, You will see the "homepage" directory shared by the Samba server, click the right mouse button on the icon, and select "Map Network Drive" to map to a local logical letter. All of the next pages and programs can be stored directly on the Linux server via disk characters.

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.