LINUX CentOS 7.2/7.3 Build LANP Environment

Source: Internet
Author: User
Tags apache log file apache log

First, let's look at the CentOS version information first.

-/etc/redhat--Q centos-release

Next we install a Web server, because it is LANP, so we choose Apache

Yum Install httpd

Then we manually launch Apache

#centos7 start Httpdapachectl start#centos6. 5 start httpd/etc/init.d/httpd start or service httpd start

Now that the Web server is set up, does it mean that it can be accessed through the Web? Yes, the browser directly accesses your server IP address and opens the Apache default page.

Next we set up boot httpd service

#centos7systemctl Enable Httpd.service

then we install the PHP5, which is also very simple , one command can

(because I have a need here, so I installed the PHP5.) 5 , if there is no special need, the direct removal of the number is good) yum install Php55#centos7 after installation restart Apacheapachectl restart

If the PHP installation is wrong, we will replace the RPM source and then re-execute the above code

7 . X rpm Source (optional):    -UVH https://mirror.webtatic.com/yum/el7/epel-release.rpm    RPM-UVH HTTPS://mirror.webtatic.com/yum/el7/webtatic-release.rpm
MySQL Installation

Generally, the information given on the Internet is

#yum Install Mysql#yum install Mysql-server#yum install Mysql-devel

Both MySQL and Mysql-devel were installed successfully, but the installation Mysql-server failed with the following:

[email protected] yl]# yum install mysql-serverloaded plugins:fastestmirrorloading mirror speeds from cached Hostfile * base:mirrors.sina.cn * extras:mirrors.sina.cn * updates:mirrors.sina.cnNo package mysql-server available. Error:nothing to do

The data found that the CentOS 7 version removed the MySQL database software from the default program list and replaced it with MARIADB.

Method One: Install MARIADB

MARIADB database management System is a branch of MySQL, mainly by the open source community in the maintenance, the use of GPL license. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of shutting MySQL out of the source, so the community uses a branching approach to avoid this risk. MARIADB is designed to be fully compatible with MySQL, including APIs and command lines, making it easy to be a replacement for MySQL.

Install MARIADB, size M.

The relevant commands for the MARIADB database are:

Systemctl Start mariadb #启动MariaDB

Systemctl Stop mariadb #停止MariaDB

Systemctl Restart MARIADB #重启MariaDB

Systemctl Enable MARIADB #设置开机启动

So start the database first

[Email protected] yl]# systemctl start mariadb

And then you can use MySQL as usual.

[Email protected] yl]# mysql-u root-penter password:welcome to the MariaDB Monitor.  Commands End With; MariaDB Connection ID is 3Server version:5.5.41-mariadb MariaDB servercopyright (c) \g.your, Oracle, Mariad B Corporation Ab and others. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. MariaDB [(None)]> show databases;+--------------------+| Database           |+--------------------+| information_schema | | mysql              | | performance_schema | | test               

After installing MariaDB is also MariaDB [(none)]>, may seem a bit unaccustomed. Here is the second method.

Method Two: Official website download installs Mysql-server
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm# RPM-IVH mysql-community-release-el7-5.noarch.rpm# Yum Install Mysql-community-server

Restart the MySQL service after the installation is successful.

# Service Mysqld Restart

The initial installation of the Mysql,root account has no password.

[Email protected] yl]# mysql-u root Welcome to the MySQL monitor.  Commands End With; or \g.your MySQL connection ID is 3Server version:5.6.26 mysql Community Server (GPL) Copyright (c), Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema | | mysql              | | performance_schema | | test               

Set Password

You do not need to restart the database to take effect.

During the MySQL installation process, the following content:

Installed:
mysql-community-client.x86_64 0:5.6.26-2.el7 mysql-community-devel.x86_64 0:5.6.26-2.el7
mysql-community-libs.x86_64 0:5.6.26-2.el7 mysql-community-server.x86_64 0:5.6.26-2.el7

Dependency installed:
Mysql-community-common.x86_64 0:5.6.26-2.EL7

Replaced:
mariadb.x86_64 1:5.5.41-2.el7_0 mariadb-devel.x86_64 1:5.5.41-2.el7_0 mariadb-libs.x86_64 1:5.5.41-2.el7_0
Mariadb-server.x86_64 1:5.5.41-2.el7_0

So after installation mariadb automatically replaced, will no longer take effect.

Configuring MYSQL1, encoding

MySQL config file is/etc/my.cnf

Finally add the encoding configuration

[Mysql]default-character-set =utf8

The character encoding here must be consistent with the/usr/share/mysql/charsets/index.xml.

2. Remote connection Settings

Assign all permissions for all tables in all databases to the root user at all IP addresses.

Mysql> Grant all privileges on * * to [e-mail protected] '% ' identified by ' password ';

If you are a new user and not root, create a new user first

Mysql>create user ' username ' @ '% ' identified by ' password ';  

The remote connection is now available.

Finally, we introduce the default installation path of the relevant files

#apache主配置文件/etc/httpd/conf/httpd.conf# related configurations such as vhost files can be created in this directory /etc/httpd/conf.d/#模块配置文件 For example, if you want to open the rewrite module, you may need to go to this directory to do some configuration /etc/httpd/conf.modules.d/#web可访问目录 website root directory /var/www/ html#apache log file directory /var/log/httpd/

LINUX CentOS 7.2/7.3 Build LANP Environment

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.