Installing MARIADB and Apache Services

Source: Internet
Author: User
Tags mkdir fully qualified domain name

Installing the MARIADB Database

Preparatory work:
Download mariadb
Official website: https://mariadb.com, select download Download the version of the free-build installation
Create MARIADB to run users, create user groups, create data store directories, and specify these when initializing

[[email protected] ]# useradd mysql[[email protected] ]# mkdir -p /data/mariadb/

Unzip to the current directory and move to the/usr/local/directory and rename it to Mariadb, and go to the MARIADB directory

[[email protected] src]# tar zxf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz -C .[[email protected] src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb

Create a MARIADB data store directory (such as/DATA/MARIADB), create a running user, run the user and MySQL using the same user, and initialize the MARIADB database

[[email protected] mariadb]#./scripts/mysql_install_db--user=mysql--basedir=/usr/local/mariadb/--datadir=/ Data/mariadbinstalling mariadb/mysql system tables in '/data/mariadb ' ... OKto start mysqld at boot time has to copysupport-files/mysql.server to the right place for your systemplease Remembe R to SET A PASSWORD for the MariaDB root USER! To does, start the server, then issue the following commands: '/usr/local/mariadb//bin/mysqladmin '-u root password ' new-p Assword '/usr/local/mariadb//bin/mysqladmin '-u root-h localhost password ' new-password ' Alternatively you can run: '/ Usr/local/mariadb//bin/mysql_secure_installation ' which would also give you the option of removing the testdatabases and Ano Nymous user created by default. This isstrongly recommended for production servers. See the MariaDB knowledgebase at http://mariadb.com/kb or Themysql manual for more instructions. You can start the MariaDB daemon with:cd '/usr/local/mariadb/'; /usr/local/mariadb//bin/mysqld_safe--Datadir= '/data/mariadb ' can test the mariadb daemon with MYSQL-TEST-RUN.PLCD '/usr/local/mariadb//mysql-test '; Perl mysql-test-run.plplease Report No problems at Http://mariadb.org/jiraThe latest information about MARIADB is Availab Le at http://mariadb.org/. You can find additional information about the MySQL part At:http://dev.mysql.comconsider joining MariaDB ' s strong and VIBR Ant community:https://mariadb.org/get-involved/[[email protected] mariadb]# echo $?0 <----initialization Success

Copy mariadb configuration files and startup scripts

[[email protected] mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf[[email protected] mariadb]# cp support-files/mysql.server /etc/init.d/mariadb

Modify the configuration my.cnf configuration file, here does not do more advanced features mariadb, here remains the default does not change

[[email protected] mariadb]# vim/usr/local/mariadb/my.cnf # Example MySQL config file for small systems.## the is F Or a system with little memory (<= 64M) where MySQL was only used# by time to time and it's important that the mysqld daemon# doesn ' t use much resources.## MySQL programs look for option files in a set of# locations which depend on the DEPL Oyment platform.# You can copy this option file to one of the those# locations. For information about these locations, see:# http://dev.mysql.com/doc/mysql/en/option-files.html## in this file, you can u Se All long options This a program supports.# If you want to know which options a program supports and run the program# with The "--help" option.# the following options would be passed to all MySQL clients[client] #password = Your_passwordport = 330 6socket =/tmp/mysql.sock# Here follows entries for some specific programs# the mysql server[mysqld]port = 3306data =/d ata/mariadb/<-------Specifies the directory where the data is stored socket =/tmp/mysql.sockskIp-external-lockingkey_buffer_size = 16kmax_allowed_packet = 1mtable_open_cache = 4sort_buffer_size = 64Kread_buffer_ Size = 256kread_rnd_buffer_size = 256knet_buffer_length = 2kthread_stack = 240K

Change the startup script file, specify the installation directory, data store directory, configuration file path information, start--default-file= need to specify the MARIADB profile path variable, so that the service starts properly and uses

# overwritten by settings in the MySQL configuration files.basedir=/usr/local/mariadbdatadir=/data/mariadbconf=$bashdir/my.cnf--------------------------------------省略内容--------------------------------- ‘start‘)    # Start daemon    # Safeguard (relative paths, core dumps..)    cd $basedir    echo $echo_n "Starting MySQL"    if test -x $bindir/mysqld_safe    then      # Give extra arguments to mysqld with the my.cnf file. This script      # may be overwritten at next upgrade.      $bindir/mysqld_safe --defaults-file="$conf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "[email protected]" &

Start the MARIADB service

Installing Apache

Apache is the name of a foundation, HTTPD is the package that the service needs to install, the early name is Apache
Apache official website: www. apache. org
The download here is the 2.4.33 version of the installation package
Httpd-2.4.33.tar.gz
Installing Apache also installs the underlying APR and apr-util libraries, which are used in the following versions
Apr-1.6.3.tar.gz
Apr-util-1.6.1.tar.gz

Apr installation Steps

Install APR and apr-util General function library, you can let httpd service does not care about the underlying system platform, can be easily re-Linux and Windows migration, the article address only reference, please do not copy the download directly!

[[email protected] src]# wget http://mirrors.hust.edu.cn/apache/apr/apr-1.6.3.tar.gz--2018-07-28 23:45:55-- Http://mirrors.hust.edu.cn/apache/apr/apr-1.6.3.tar.gz parsing host mirrors.hust.edu.cn (mirrors.hust.edu.cn) ... 202.114.18.160 connecting mirrors.hust.edu.cn (mirrors.hust.edu.cn) |202.114.18.160|:80 ... is connected. An HTTP request has been made and is waiting for a response ... $ OK Length: 1072661 (1.0M) [Application/octet-stream] saving to: "Apr-1.6.3.tar.gz" 100%[================================== ====================>] 1,072,661 130kb/s spents 8.8s 2018-07-28 23:46:04 (119 kb/s)-Saved "apr-1.6.3.tar.gz" [1072661/107 2661]) [[email protected] src]# lsapr-1.6.3.tar.gz httpd-2.4.33.tar.gz mariadb-10.0.16-linux-glibc_214-x86_64. tar.gz pip-10.0.1 python-3.7.0.tgz tmpcmake-3.12.0.tar.gz jiaoben mysql-5.7.22 pip-10.0.1.tar.gz setuptools-39.2.0 userhttpd-2.4.33 jisuan.py mysql-5.7.22.tar.gz Python-3.7.0 setuptools-39.2.0.zip[[email protected] src]# wget Http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.1.tar.gz--2018-07-28 23:46:17--http://mIrrors.hust.edu.cn/apache/apr/apr-util-1.6.1.tar.gz parsing host mirrors.hust.edu.cn (mirrors.hust.edu.cn) ... 202.114.18.160 connecting mirrors.hust.edu.cn (mirrors.hust.edu.cn) |202.114.18.160|:80 ... is connected. An HTTP request has been made and is waiting for a response ... $ OK Length: 554301 (541K) [Application/octet-stream] saving to: "Apr-util-1.6.1.tar.gz" 100%[============================== ====================>] 554,301 110kb/s spents 5.5s 2018-07-28 23:46:23 (98.4 kb/s)-Saved "apr-util-1.6.1.tar.gz" [554301/ 554301]) [[email protected] src]# tar zxf apr-1.6.3.tar.gz-c. [[email protected] src]# CD apr-1.6.3/[[email protected] apr-1.6.3]#./configure--PREFIX=/USR/LOCAL/APR Checking build system Type ... x86_64-pc-linux-gnuchecking host system type ... x86_64-pc-linux-gnuchecking target system t ype x86_64-pc-linux-gnuconfiguring APR Library----------------------ellipsis process-----------------------Config.status: Executing libtool commandsrm:cannot Remove ' libtoolt ': No such file or directory <---prompt but not error config.status: Executing DEFAUlt commands[[email protected] apr-1.6.3]# echo $?0[[email protected] apr-1.6.3]# Make;make Install------------------------procedure omit/usr/bin/install-c-M 644 build/apr_rules.out/usr/local/apr/build-1/apr_ Rules.mk/usr/bin/install-c-M 644/usr/local/src/apr-1.6.3/build/apr_common.m4/usr/local/apr/build-1/usr/bin/ Install-c-M 644/usr/local/src/apr-1.6.3/build/find_apr.m4/usr/local/apr/build-1/usr/bin/install-c-M 755 Apr-config.out/usr/local/apr/bin/apr-1-config[[email protected] apr-1.6.3]# Echo $?0
Compiling and installing Apr-util

Unzip the Apr-util package file, compile the installation apr-util, compile the Apr-util function library, you need to specify the installation path of APR, so that the correct compilation

[[email protected] src]# tar zxf apr-util-1.6.1.tar.gz -C .[[email protected] src]# cd apr-util-1.6.1/[[email protected] apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprchecking build system type... x86_64-pc-linux-gnuchecking host system type... x86_64-pc-linux-gnu---------------------------过程省略------------------config.status: executing default commands[[email protected] apr-util-1.6.1]# echo $?0[[email protected] apr-util-1.6.1]# make;make installmake[1]: 进入目录“/usr/local/src/apr-util-1.6.1”---------------------------过程省略------------------/usr/bin/install -c -m 644 aprutil.exp /usr/local/apr-util/lib/usr/bin/install -c -m 755 apu-config.out /usr/local/apr-util/bin/apu-1-config[[email protected] apr-util-1.6.1]# echo $?0
Compile and install Apache

Unzip the Apache package file and go into execution (where the backslash indicates the intention to write a command into multiple lines of input)
./configure \
--prefix=/usr/local/httpd \
--with-apr=/usr/ LOCAL/APR \
--with-apr-util=/usr/local/apr-util \
--enable-so \ Add--enable-so support for dynamically expanding modules
-- Enable-mods-shared=most add most of the function modules that need to be used

[[email protected] httpd-2.4.33]#./configure >--prefix=/usr/local/httpd >--with-apr=/usr/local/apr > --with-apr-util=/usr/local/apr-util >--enable-so >--enable-mods-shared=mostchecking for chosen Layout ... Apachechecking for working mkdir-p ... yeschecking for grep that handles long lines and-e .../usr/bin/grepchecking for eg Rep ... /USR/BIN/GREP-E------------------------ellipsis process--------------------config.status:creating Include/ap_config_ Auto.hconfig.status:executing default commandsconfigure:summary of Build Options:server version:2.4.33 Install p Refix:/usr/local/httpd C compiler:gcc-std=gnu99 CFLAGS:-g-o2-pthread cppflags:-dlinu X-d_reentrant-d_gnu_source Ldflags:libs:c Preprocessor:gcc-e[[email protecte D] httpd-2.4.33]# Echo $?0[[email protected] httpd-2.4.33]# Make;make Install--------------------the compilation process omitted--------------------------mkdir/usr/local/httpd/manualmake[1]: Leave the catalogue "/usr/local/src/httpd-2.4.33" [[email protected] httpd-2.4.33]# Echo $?0 <---------------compile results without error

Compile process If there is an error does not exist a library, based on the information of the error to install the corresponding package, the library installation package is generally a level or devel word package, using Yum list can find out the corresponding installation package

Apache each directory store file simple to understand

[[email protected] httpd]# ll-h bin/httpd-rwxr-xr-x 1 root root 2.3M July 00:32 bin/httpd <------APA Che's startup file [[[email protected] httpd]# ls conf/extra httpd.conf Magic mime.types Original <-----configuration directory [[email protected] httpd]# ls htdocs/index.html <-----The root of the default Web site [[Email&nbs p;protected] httpd]# ls logs/<---------log file directory [[email protected] httpd]# ls modules/<---- ----The module that has already been loaded, static module, shared is dynamically loaded module Httpd.exp mod_authz_dbd.so mod_deflate.so mod_log_config.so mod_proxy_ scgi.so mod_socache_dbm.somod_access_compat.so mod_authz_dbm.so mod_dir.so mod_log_debug.so mod_proxy.so Mod_socache _memcache.somod_actions.so mod_authz_groupfile.so mod_dumpio.so mod_logio.so mod_proxy_uwsgi.so mod_socache_ shmcb.somod_alias.so mod_authz_host.so mod_env.so mod_macro.so mod_proxy_wstunnel.so mod_speling.somod_ allowmethods.so mod_authz_owner.so mod_expires.so mod_mime.so Mod_ratelimit.so mod_ssl.somod_auth_basic.so mod_authz_user.so mod_ext_filter.so mod_negotiation.so mod_remoteip.so mod_ status.somod_auth_digest.so mod_autoindex.so mod_file_cache.so mod_proxy_ajp.so mod_reqtimeout.so mod_ substitute.somod_auth_form.so mod_buffer.so mod_filter.so mod_proxy_balancer.so mod_request.so mod_unique_id.somod_ authn_anon.so mod_cache_disk.so mod_headers.so mod_proxy_connect.so mod_rewrite.so mod_unixd.somod_authn_core.so MoD _cache.so mod_include.so mod_proxy_express.so mod_sed.so mod_userdir.somod_authn_dbd.so mod_cache_socache.so mod_ info.so mod_proxy_fcgi.so mod_session_cookie.so mod_version.somod_authn_dbm.so mod_cgid.so mod_lbmethod_ bybusyness.so mod_proxy_fdpass.so mod_session_dbd.so mod_vhost_alias.somod_authn_file.so mod_dav_fs.so Mod_lbmethod _byrequests.so mod_proxy_ftp.so mod_session.so mod_watchdog.somod_authn_socache.so mod_dav.so mod_lbmethod_ bytraffic.so mod_proxy_hcheck.so mod_setenvif.somod_authz_core.so mod_dbd.so mod_lbmethod_heartbeat.so mod_proxy_ Http.so moD_slotmem_shm.so[[email protected] httpd]#/usr/local/httpd/bin/httpd-mah00558:httpd:could not reliably Determine the server ' s fully qualified domain name, using:: 1. Set the ' ServerName ' directive globally to suppress this messageloaded modules:core_module (static) So_module (static) HT Tp_module (Static) Mpm_event_module (Static) Authn_file_module (shared) authn_core_module (shared) Authz_host_module ( Shared) Authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) Access_compat_module ( Shared) Auth_basic_module (shared) reqtimeout_module (shared) filter_module (shared) mime_module (shared) Log_config_ Module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) unixd_ Module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared)

Start the Apache compilation installation by default there is no startup script, you can use the command to start, after startup and view the corresponding process and port number

[[email protected] httpd]#/usr/local/httpd/bin/apachectl startAH00558:httpd:Could not reliably determine the Server ' s fully qualified domain name, using:: 1. Set the ' ServerName ' directive globally to suppress this message[[email protected] httpd]# Ps-axu |grep httpdroot 87 3 0.0 0.2 70952 2252? Ss 01:19 0:00/usr/local/httpd/bin/httpd-k Startdaemon 874 0.0 0.2 359916 2220? Sl 01:19 0:00/usr/local/httpd/bin/httpd-k startdaemon 875 0.0 0.2 359916 2220? Sl 01:19 0:00/usr/local/httpd/bin/httpd-k startdaemon 876 0.0 0.2 359916 2220? Sl 01:19 0:00/usr/local/httpd/bin/httpd-k startroot 959 0.0 0.0 112724 976 pts/2 r+ 01:19 0:00 grep--color=auto httpd[[ Email protected] httpd]# netstat-nltpactive Internet connections (only servers) Proto recv-q send-q Local Address for Eign Address State Pid/program name TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1085/sshd TCP 0 0 127.0.0.1:25 0.0.0.     0:* LISTEN 1388/master tcp6 0 0::: 3306:::* LISTEN 23181/mysqld   TCP6 0 0:::-:::* LISTEN 873/httpd tcp6 0 0::: +:::* LISTEN 1085/sshd tcp6 0 0:: 1:25:::* LIST  EN 1388/master

Install MARIADB and Apache services

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.