1. Install MySQL
Directly go to terminal to install
zypper install mysql-community-server mysql-community-server-client
Then we create a system startup link for MySQL (which can enable MySQL to automatically start when the system starts) and start the MySQL server (completed under the root user ):
/sbin/chkconfig --add mysql
Initialize Configuration
mysql_install_db chown -R mysql.mysql /var/lib/mysql
Start the MySQL service.
/etc/init.d/mysql start
Perform Security Initialization:
mysql_secure_installation
Log on to the terminal using the directory.
mysql -u root -p
For more information about MySQL login, see this article.
Summary MySQL error 2002 (hy000): Can't connect ..
2. Install apache2
Terminal Operation
zypper install apache2
Next
Activate and start Apache
systemctl enable apache2.service
systemctl start apache2.service
Access the server in a browser: http: // 127.0.0.1/
In opensuse, the default Apache document path is/srv/www/htdocs/, and the configuration file is/etc/apache2/httpd. conf, and other configuration files are stored in/etc/apache2/CONF. d/folder.
3. install PHP
Terminal Operation
zypper install apache2-mod_php5
After installation, create a PHP test file.
vim /srv/www/htdocs/test.php
The content is in one sentence:
<?php phpinfo();?>
Save and exit (WQ !).
Restart the server and run the terminal:
/etc/init.d/apache2 restart
Enter the URL http: // 127.0.0.1/test. php In the browser. The following content is displayed. PHP configuration is successful.
4. Add a PHP Module
Currently, PHP only has basic runtime modules, and some other things need to be installed.
zypper install php5-mysql php5-bcmath php5-bz2 php5-calendar php5-ctype php5-curl php5-dom php5-ftp php5-gd php5-gettext php5-gmp php5-iconv php5-imap php5-ldap php5-mbstring php5-mcrypt php5-odbc php5-openssl php5-pcntl php5-pgsql php5-posix php5-shmop php5-snmp php5-soap php5-sockets php5-sqlite php5-sysvsem php5-tokenizer php5-wddx php5-xmlrpc php5-xsl php5-zlib php5-exif php5-fastcgi php5-pear php5-sysvmsg php5-sysvshm
Restart Apache after installation
/etc/init.d/apache2 restart
Visit http: // 127.0.0.1/test. php again and find that the module is complete.
5. Install phpMyAdmin
This is relatively simple and can be found directly in the YaST manager search.
After installation, enter the address http: // 127.0.0.1/PHPmyAdmin/in the browser to view the phpMyAdmin startup page.
Summary
So far, even if the environment is basically ready, it still feels quite smooth and has not encountered any major problems, or even no need to compile any files, the minor problem is also solved by Google, and the lamp configuration in Linux is similar.
For more information, see.
Reference: Installing apache2 with PhP5 and MySQL on opensuse 12.1-http: // www.unixmen.com/installing-apache2-with-php5-and-mysql-on-opensuse-121/