Create a Web server in openSUSE 12.1

Source: Internet
Author: User
Tags file info

With the continuous development of Internet technology, Web servers are widely used in small and medium-sized enterprises. Building Web servers is a basic skill that managers often encounter. Web Server construction can be divided into two types: Windows or Linux. Windows can be built by using its own IIS Server, or by using third-party software, such as the Home Web Server software; for Linux, Apache is a commonly used software.

Linux is a popular Web server construction system in recent years. It has quickly become the mainstream of Web servers with open source, stable, and high security features. In China, Red Hat can be said to be the most popular Linux System for server construction. However, openSUSE is widely used internationally based on its powerful performance, in fact, the principle of setting up a server in Linux is basically the same, but some specific command operations are different. This article shows how to build an Apache2 Web server on the server version of openSUSE12.1.

LAMP is short for Lniux, Apache, MySQL, and PHP. Here we will show you how to build Apache2 Web servers with PHP5 and MySQL in OpenSUSE 12.1 server version. For details, refer to the following steps.

1. Start description

The IP address used in this tutorial is 192.168.0.100, and the host name is Server1.example.com. These settings may be different. You need to modify them according to different situations.

Install MySQL5 in openSUSE 12.1

2. Install MySQL5

First, run the following command to install MySQL5:

yast2 -i mysql mysql-client mysql-community-server

Then we need to create the MySQL system startup key link to start the MySQL server so that MySQL can be automatically started when the system is started,

systemctl enable mysql.servicesystemctl start mysql.service

To ensure that MySQL installation is complete, run:

mysql_secure_installation

The following prompt is displayed;

Server1 :~ # Mysql_secure_installationNOTE: running all parts of this script is recommended for all MySQLSERVERS in production use! Please read each step carefully! In order to log into MySQL to secure it, we'll need the currentpassword for the root user. if you 've just installed MySQL, andyou haven' t set the root password yet, the password will be blank, so you shoshould just press enter here. enter current password for root (enter for none): <-- Enter the password OK, successfully used password, moving on... setting the root password ensures that nobody can log into the MySQLroo T user without the proper authorisation. Set root password? [Y/n] <-- enter YNew password: <-- set database password Re-enter new Password: <-- Re-enter Database password updated successfully! Reloading privilege tables... Success! By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem. this is intended only for testing, and to make the installationgo a bit smoother. you shoshould remove them before moving into aproduction environment. remove anonymous users? [Y/n] <-- select Y... Success! Normally, root shoshould only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] <-- select Y... Success! By default, MySQL comes with a database named 'test' that anyone canaccess. this is also intended only for testing, and shocould be removedbefore moving into a production environment. remove test database and access to it? [Y/n] <-- select Y-Dropping test database... Success! -Removing privileges on test database ...... Success! Reloading the privilege tables will ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [Y/n] <-- select Y... Success! Cleaning up... All done! If you 've completed all of the above steps, your MySQLinstallation shoshould now be secure. Thanks for using MySQL! Server1 :~ #

Now your MySQL installation should be successful

Install Apache2 in openSUSE 12.1

3. Install Apache2 in openSUSE 12.1

Apache2 is used as an openSUSE software package. Therefore, we can use the following command to install it:

yast2 -i apache2

Now configure the system to start Apache at boot

systemctl enable apache2.service

And start Apache2

systemctl start apache2.service

Enter the http: // keystore file root directory in your browser )):


Error Message

The default Apache document root directory is the/srv/www/htdocs/directory on openSUSE, And the configuration file is/etc/apache2/httpd. conf. Configure the directory stored in/etc/apache2/conf. d.

4. Install PHP5

We can install the PHP5 and Apache PHP5 modules as follows:

yast2 -i apache2-mod_php5

After the event, we must restart Apache:

systemctl restart apache2.service
In openSUSE 12.1, PHP5

5. Test PHP5 and obtain the installation information of PHP5.

By default, the file root directory of the website is in/srv/www/htdocs. Now we will create a small php file info. php In this directory) and call it in the browser. This file will show a lot of details about our PHP installation, such as the installed PHP version and some useful information.

Vi/srv/www/htdocs/info. php PHP settings

If you get the message that you do not have a valid Vim binary package installed. Install "VIM", "vim enhanced", or "gvim". Run the following command:

yast2 -i vim

Install VI and try again.

Now, in the browser such as file http: // 192.168.0.100/info. php ):


PHP Homepage

As you can see, PHP5 works through Apache 2.0's processing program on the Server API line. If you continue to scroll down, you will see all modules enabled in PHP5. MySQL is not listed, which means that MySQL is not supported in PHP5.

6. Obtain MySQL support

Let PHP get support in MySQL, we can install php5-mysql packages. It is a good idea to install some other PHP5 modules and applications you may need:

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

Restart Apache2 now:

systemctl restart apache2.service

Now, reload http: // 192.168.0.100/info. php in your browser and scroll down to the module area again. Now, you should find many new modules, including the MySQL module:


MYSQL display

Install phpMyAdmin in openSUSE 12.1

7. Install phpMyAdmin

PhpMyAdmin is a network interface that can be used to manage your MySQL database.

PhpMyAdmin can be installed as follows:

yast2 -i phpMyAdmin

To make sure that you can access phpMyAdmin through all the sites created by ISPConfig later and log on to phpmyadminhttp: // www.example.com/phpmyadmin) and phpMyAdmin such as http://www.example.com/phpMyAdmin), Open/etc/apache2/conf. d/phpMyAdmin. conf File Settings

vi /etc/apache2/conf.d/phpMyAdmin.conf

And add the following two aliases:


Set alias

Restart Apache:

systemctl restart apache2.service

Enter http: // 192.168.0.100/phpMyAdmin/: in the address bar to access phpMyAdmin.


PhpMyAdmin page

The above is the specific process of building a Web server in openSUSE12.1 server version. You can follow the prompts to perform step-by-step operations. Basically, you can set the settings. You can try using a virtual machine, after all, setting up a server in Linux is a common operation.

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.