Install php, mysql, and apache under solaris10

Source: Internet
Author: User
Tags gtar automake
Install php, mysql, apache-Linux Enterprise Application-Linux server application in solaris10. For details, refer to the following section. Set, test, and start Apache2

Apache 2.xxhas been installed in Solaris 10. You only need to make some settings.

1. First, use the Root user to log on to the text Mode system (Console Mode)

2. Copy/etc/apache2/httpd. conf-example to/etc/apache2/httpd. conf.

# Cp/etc/apache2/httpd. conf-example/etc/apache2/httpd. conf

3. edit/etc/apache2/httpd. conf.

Set the ServerName server name you need. The default value is 127.0.0.1.

Set the correct email address in ServerAdmin

4. Run the following command to start Apache

# Svcadm enable apache2

Then, try to restart Solaris to see if Apache cannot be started automatically. The location of the basic webpage file is/var/apache2/htdocs.

Set, test, and start MySQL

MySQL has been installed in Solaris 10. The installer must log on to the system as the Root user. The following installation steps can be found in the/usr/sfw/src/mysql/Docs directory.

1. Use the root identity login to the Console mode and prepare the database beforehand.
#/Usr/sfw/bin/mysql_install_db
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
060118 21:24:03/usr/sfw/sbin/mysqld: Shutdown Complete


2. Create a mysql user and group and change the group of the data directory.
# Groupadd mysql
# Useradd-g mysql
# Chgrp-R mysql/var/mysql
# Chmod-R 770/var/mysql
# Installf SUNWmysqlr/var/mysql d 770 root mysql

3. Set the File Location of MySQL to/var/mysql/my. cnf by default.

4. Copy the MySQL file to the default location.
# Cp/usr/sfw/share/mysql/my-medium.cnf/var/mysql/my. cnf

5. manually start mysql
#/Usr/sfw/sbin/mysqld_safe -- user = mysql &

6. Set the MySQL root user password (new-password in the following section, you can change the password you like on your own. For security reasons, do not use new-password as your password. You must change the password)
# Cd/usr/sfw/bin
#./Mysqladmin-u root password 'new-password'
#./Mysqladmin-u root-h 'hostname' password 'new-password'

7. Test MySQL Server
#./Mysqlshow-p
Enter password: new-password
+ ----------- +
| Databases |
+ ----------- +
| Mysql |
| Test |
+ ----------- +
#./Mysql-u root-p
Enter password: new-password
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 3 to server version: 4.0.20-standard
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.

Mysql> show databases;
+ ----------- +
| Databases |
+ ----------- +
| Mysql |
| Test |
+ ----------- +
2 rows in set (0.00 sec)

Mysql> quit;
Bye

8. Set the Solaris Server to automatically run and stop MySQL Server when it is started or shut down.
# Ln/etc/sfw/mysql. server/etc/rc3.d/S99mysql
# Ln/etc/sfw/mysql. server/etc/rc0.d/K00mysql
# Ln/etc/sfw/mysql. server/etc/rc1.d/K00mysql
# Ln/etc/sfw/mysql. server/etc/rc2.d/K00mysql
# Ln/etc/sfw/mysql. server/etc/rcS. d/K00mysql

9. Try restarting Solaris to see if MySQL cannot be started automatically. By default, MySQL sets the file location to/var/mysql/my. cnf.

Download and set PHP

1. Use the root identity login to the Console mode.

2. Check whether the PATH contains/opt/csw/bin and/usr/sfw/bin. If not, add it on your own. (/Etc/profile)

PATH = .....
Modify the/etc/profile file, append the above output line to the file, save and run # bash; # source/etc/profile to make the modification of the environment variable take effect.

# Bash
# Export PS1 = '\ u: \ w #'
Root:/# echo $ PATH
/Opt/csw/bin:/usr/sfw/bin:/usr/sbin:/usr/bin:/usr/openwin/bin:/usr/dt/bin: /usr/ccs/bin

3. Install pkg-get
Root:/# mkdir/usr/local/src
Root:/# cd/usr/local/src
Root:/usr/local/src # wget http://www.blastwave.org/pkg_get.pkg
Root:/usr/local/src # cp pkg_get.pkg ..
Root:/usr/local/src # pkgadd-d pkg_get.pkg all

You may use and copy this software without charge, as you see fit.
The software is copyright (C) Philip Brown, Nov 2002

Dont forget to update/opt/csw/etc/pkg-get.conf with your nearest archive site.
The selected base directoryMust exist before installation
Is attempted.

Do you want this directory created now [y, n ,?, Q] y
UsingAs the package base directory.
# Processing package information.
# Processing system information.
2 package pathnames are already properly installed.
# Verifying disk space requirements.
# Checking for conflicts with packages already installed.
# Checking for setuid/setgid programs.

This package contains scripts which will be executed with super-user
Permission during the process of installing this package.

Do you want to continue with the installation [Y, n,?] Y

Installing pkg_get-CSW version of automatic package download tool

# Installing part 1 of 1.
/Opt/csw/bin/pkg-get
/Opt/csw/etc/pkg-get.conf.csw
/Opt/csw/share/man/man1m/pkg-get.1m
/Var/pkg-get/admin-fullauto
[Verifying class ]
# Executing postinstall script.

Installing/opt/csw/etc/pkg-get.conf.csw to pkg-get.conf
Installation Was successful.

Root:/usr/local/src # cd/
Root :/#

4. Check whether pkg-get and wget are installed.
Root:/# which pkg-get
/Opt/csw/bin/pkg-get
Root:/# which wget
/Usr/sfw/bin/wget

5. Install the complete wget Software
Root:/# pkg-get-I wget
Note: There will be a lot of text, don't worry, as long as the installation is complete.

6. Remove the old wget version.
Root:/# cd/usr/sfw/bin
Root:/usr/sfw/bin # mv wget. orig
Root:/usr/sfw/bin # exit
# Bash
# Export PS1 = '\ u: \ w #'
Root :/#

7. Check whether the new position of wget is correct.
Root:/# which wget
/Opt/csw/bin/wget

8. Check whether the GNU Autoconf version is 2.59 or later.
Root:/# which autoconf & autoconf -- version | head-2
/Opt/csw/bin/autoconf
Autoconf (GNU Autoconf) 2.59
Written by David J. macenzie and Akim Demaille.
If the program is not 2.59 or later or does not exist at all, run the following command:
Root:/# pkg-get-I autoconf

9. Check whether the GNU automake version is 1.8.3 or later.
Root:/# which automake & automake -- version | head-2
/Opt/csw/bin/automake
Automake (GNU automake) 1.8.3
Written by Tom Tromey .
If the program is not 1.8.3 or later or does not exist at all, run the following command:
Root:/# pkg-get-I automake

10. Check whether the version of GNU sed is 4.1.4 or later.
Root:/# which gsed & gsed -- version | head-2
/Opt/csw/bin/gsed
GNU sed version 4.1.4
Copyright (C) 2003 Free Software Foundation, Inc.
If the program is not 4.1.4 or later or does not exist at all, run the following command:
Root:/# pkg-get-I gsed

11. Check whether the gcc version is 3.4.3 or later.
Root:/# which gcc & gcc -- version | head-2
/Usr/sfw/bin/gcc
Gcc (GCC) 3.4.3 (csl-sol210-3_4-branch + sol_rpath)
Copyright (C) 2004 Free Software Foundation, Inc.
If the program is not 3.4.3 or later or does not exist at all, run the following command:
Root:/# pkg-get-I gcc

12. Check whether the GNU Make version is 3.80 or later.
Root:/# which gmake & gmake -- version | head-2
/Usr/sfw/bin/gmake
GNU Make 3.80
Copyright (C) 2002 Free Software Foundation, Inc.
If the program is not 3.80 or later or does not exist at all, run the following command:
Root:/# pkg-get-I gmake

13. Check whether the flex version is 2.5.4 or later.
Root:/# which flex & flex -- version | head-2
/Usr/sfw/bin/flex
Flex version 2.5.4
If the program is not 2.5.4 or later or does not exist at all, run the following command:
Root:/# pkg-get-I flex

14. Check if the GNU Bison version is 1.875 or later.
Root:/# which bison & bison -- version | head-2
/Usr/sfw/bin/bison
Bison (GNU Bison) 1.875
Written by Robert Corbett and Richard Stallman.
If the program is not 1.875 or later or does not exist at all, run the following command:
Root:/# pkg-get-I bison

15. Check if the version of GNU M4 is 1.4.3 or later.
Root:/# which gm4 & gm4 -- version | head-2
/Opt/csw/bin/gm4
GNU M4 1.4.3
Written by Rene 'seindal.
If the program is not 1.4.3 or later or does not exist at all, run the following command:
Root:/# pkg-get-I gm4

16. Check whether the Perl version is 5.8 or later.
Root:/# which perl & perl-v | head-2
/Usr/bin/perl
This is perl, v5.8.4 built for i86pc-solaris-64int
If the program is not 5.8 or later or does not exist at all, run the following command:
Root:/# pkg-get-I perl

17. Check if the GNU zip version is 1.3.3 or later.
Root:/# which gunzip & gunzip-V | head-2
/Usr/bin/gunzip
Gunzip 1.3.3-patch.1
(2002-03-08)
If the program is not 1.3.3 or later, or the program does not exist at all, run the following command:
Root:/# pkg-get-I gunzip

18. Check if the GNU tar version is 1.14 or later.
Root:/# which gtar & gtar -- version | head-2
/Usr/sfw/bin/gtar
Tar (GNU tar) 1.14
Copyright (C) 2004 Free Software Foundation, Inc.
If the program is not 1.14 or later or does not exist at all, run the following command:
Root:/# pkg-get-I gtar

19. Install libxml2 version 2.6.23
Note that this program cannot be installed on the Driver that needs to be mounted before libxml2 is installed.
Because libxml2 is required when Apache/php is automatically started when Solaris is started. However, the mount Driver is not started yet.
In many cases, you are used to putting/usr/local on the mount driver. If you have this habit, please note that do not install libxml2 on/usr/local.
Otherwise, Apache/php cannot be started automatically after Solaris is started.
Normally, libxml2 is installed. The default installation path of the installer is/usr/local, which can be changed.
In the following example, libxml2 is installed on/usr/slocal.
Root:/# cd/usr/local/src
Root:/usr/local/src # wget ftp://xmlsoft.org/libxml2/libxml2-2.6.23.tar.gz
...
Root:/usr/local/src # mkdir/usr/slocal
Root:/usr/local/src # cp libxml2-2.6.23.tar.gz/usr/slocal/
Root:/usr/local/src # cd/usr/slocal
Root:/usr/slocal # gunzip-cd libxml2-2.6.23.tar.gz | gtar xvpf-
...
Root:/usr/slocal # cd libxml2-2.6.23
Root:/usr/slocal/libxml2-2.6.23 #./configure -- prefix =/usr/slocal
...
Root:/usr/slocal/libxml2-2.6.23 # gmake
...
Root:/usr/slocal/libxml2-2.6.23 # gmake install

20. If the file/etc/apache2/httpd. conf does not exist in the system
Root:/# cp/etc/apache2/httpd. conf-example/etc/apache2/httpd. conf edit/etc/apache2/httpd. conf

§ Set the ServerName server name you need. The default value is 127.0.0.1.

§ Set the correct email address in ServerAdmin

21. download the latest version of PHP (http://www.php.net/downloads.php)
Root:/# cd/usr/local/src
Root:/usr/local/src # wget http://hk.php.net/get/php-5.1.2.tar.gz/from/this/mirror
...
Root:/usr/local/src # cp php-5.1.2.tar.gz ..
Root:/usr/local/src # cd ..
Root:/usr/local # gunzip-cd php-5.1.2.tar.gz | gtar xvpf-
...
Root:/usr/local # php-5.1.2 cd
Root:/usr/local/php-5.1.2 #./configure -- with-apxs2 =/usr/apache2/bin/apxs \
-- With-mysql =/usr/sfw/-- enable-dbase -- with-libxml-dir =/usr/slocal \
-- With-config-file-path =/etc/apache2 -- with-gd-dir =/opt/sfw/bin \
-- With-jpeg-dir =/usr/lib -- with-png-dir =/usr/lib -- with-zlib -- enable-mbstring
...
Root:/usr/local/php-5.1.2 # gmake
...
Root:/usr/local/php-5.1.2 # gmake install

Installing php sapi module :....................

Root:/usr/local/php-5.1.2 # cp php. ini-dist/etc/apache2/php. ini
Root:/usr/local/php-5.1.2 #

22. Go To The apache2 setting file directory.
Root:/usr/local/php-5.1.2 # cd/etc/apache2
Root:/etc/apache2 #

23. To set other php options, edit/etc/apache2/php. ini.

24. Edit the httpd. conf file
After installing php, php will add the following sentence in/etc/apache2/httpd. conf. Check whether the sentence exists:
LoadModule php5_module libexec/libphp5.so
Add the following sentence manually in the last line of/etc/apache2/httpd. conf:
AddType application/x-httpd-php. php

25. Start Apache2 and Test
# Svcadm enable apache2
# Svcs | grep-I apache2
Online 18:07:10 svc:/network/http: apache2

26. Try restarting Solaris and see if Apache2 cannot be started automatically. If you cannot start it automatically, but you can only start it manually, please read the instructions in section 19th.
Set the file location to/etc/apach2/httpd. conf by default.
Related Article

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.