CentOS 7.2 Yum builds lamp

1. Close firewall and selinux after system installation

1. sestatus: Check selinux status;
2. getenforce view status;
3. Temporarily close selinux:
setenforce 0
4. If you want to close permanently, you can modify the configuration file / etc/selinux/config and set SELINUX to disabled.

sudo vi /etc/sysconfig/selinux
SELINUX = disabled

Modifying the configuration file can also be accomplished by executing the following commands:

sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config

5. CentOS 7.2 Close Firewall

systemctl stop firewalld.service    #Stop firewall
systemctl disable firewalld.service    #Prohibit firewall boot-up
firewall-cmd –list-ports   #View open ports

Open port

firewall-cmd –zone=public –add-port=80/tcp –permanent

Implication of order:
- zone # scope
- add-port=80/tcp # add port, in port/communication protocol format
permanent # permanently in effect. Failure after restart without this parameter

firewall-cmd –reload   #Restart firewall 
systemctl stop firewalld.service #Stop firewall 
systemctl disable firewalld.service #Prohibit firewall boot-up 
firewall-cmd –state #View the default firewall status (not running after closing and running after opening)

2. Building lamp environment

1. Add the latest warehouse

sudo yum install https://centos7.iuscommunity.org/ius-release.rpm -y

2. Installing apache

sudo yum install httpd -y

Open apache service

systemctl start httpd.service

Set apache service boot

systemctl enable httpd.service

Install nginx

sudo yum install nginx -y

3. Install the latest mysql

yum search mariadb

sudo yum install mariadb101u-server mariadb101u-devel libxml2-devel net-snmp net-snmp-devel net-snmp-libs net-snmp-perl net-snmp-utils mrtg curl-devel -y

Resolving conflicts
sudo yum remove mariadb-libs -y

Set the database code: vi/etc/my.cnf.d/mariadb-server.cnf


Add the following under [mysqld]:

character_set_server=utf8

Start MariaDB:

sudo systemctl start mariadb

Start up with the following commands:

sudo systemctl enable mariadb.service

Database Security Settings

sudo mysql_secure_installation

4. Installing PHP

yum search php sudo yum install php71u php71u-fpm php71u-cgi
php71u-mysql php71u-mysqli php71u-pgsql php71u-curl php71u-json
php71u-tidy php71u-dev php71u-mcrypt php71u-xdebug php71u-gd
php71u-xmlrpc php71u-intl php71u-xsl php71u-redis php71u-mbstring
php71u-bcmath php71u-snmp php71u-soap php71u-pecl-apcu -y

Start php-fmp

sudo systemctl start php-fpm

Set up boot start

sudo systemctl enable php-fpm

5. Configure php nginx

sudo vi /etc/nginx/conf.d/default.conf server{ listen 80; server_name
localhost; root /var/www/html; index index.php index.html; location /
{
try_files uriuri/ /index.php?$query_string; }

location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf; } }

sudo systemctl stop | start nginx #Open and close
sudo systemctl reload nginx #graceful restart

6. Install composer

Official address:

https://getcomposer.org/download/

php -r "copy('https://getcomposer.org/installer',
'composer-setup.php');"

php -r "if (hash_file('SHA384', 'composer-setup.php') ===
'55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30')
{ echo 'Installer verified'; } else { echo 'Installer corrupt';
unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php
php -r "unlink('composer-setup.php');" echo $PATH sudo mv
composer.phar /usr/local/bin/composer

vi ~/.bash_profile increase

$HOME/.composer/vendor/bin source ~/.bash_profile

7. Installing git

yum search git
sudo yum install git2u -y
git config –global user.name"Your username"
git config –global user.email "Your e-mail address"

8. Install before compiling

yum install gcc

9. Note that 403 forbidden may occur if Apache 2.4

First check the status of selinux on your system:

sestatus

The above command returns:

[root@localhost html]# sestatus 
SELinux status: enabled 
SELinuxfs mount: /sys/fs/selinux 
SELinux root directory: /etc/selinux 
Loaded policy name: targeted 
Current mode: permissive 
Mode from config file: enforcing 
Policy MLS status: enabled 
Policy deny_unknown status: allowed 
Max kernel policy version: 28

Current mode is enforcing, which means selinux is running. You can turn it off temporarily:

You are using CentOS inventory installation, if this is correct, check if SELinux is in mandatory mode

getenforce

If the result is "Enforcing"

Change temporarily to

setenforce 0

If you want to close permanently, you can modify the configuration file / etc/selinux/config and set SELINU to disabled:

sudo vi /etc/sysconfig/selinux

III. Installation of redis services

Download $wget http://download.redis.io/releases/redis-3.2.5.tar.gz
 Unzip $tar xzf redis-3.2.5.tar.gz
 Enter directory $cd redis-3.2.5
 Compile $make

Execute the make install command to copy these executable programs into the / usr/local/bin directory so that they can be executed later without entering the full path.

Before actually running Redis, it is recommended to use the make test command to test whether Redis is compiled correctly, especially when compiling an unstable version of Redis.

After installation, common tools are automatically copied to the / user/loca/bin directory. As servers, we often need to set redis to boot and boot. There is a very useful script in the source package, install_server.sh, to execute the footsteps according to the prompt input.

# Enter the utils directory for execution

./install_server.sh

redis background boot:

After installing redis, we can find a file called redis.conf, which is the location of redis configuration file.

Find the general configuration in the file and see the first configuration item, daemonize. According to the instructions, set daemonize to yes, as shown in the figure:

daemonize yes

Save, exit, and start redis. Of course, when you start, you should pay attention to using the configuration file you just configured, as shown in the figure:

# Go to the installation directory of redis, for example: / usr/local/src/redis-stable/src/

Execute the startup command:
./redis-service /etc/redis/6379.conf

After booting, we didn't type out a lot of content as before, because we used the background boot to confirm whether to boot, we can use the ps-ef | grep redis command.

ps -ef|grep redis

Reference address: http://blog.csdn.net/u011138533/article/details/53082132

Note that the configuration is remote access:

1. Note out bind 127.0.0.1;
2. Modify protected-mode no;

IV. Configure directory mapping for Apache

The practices are as follows:

1. Find the / xampp/apache/conf/httpd.conf file

2. Find the <IfModule alias_module> </ifModule> code block

3. Add the following code [php] view plaincopy

 / radworkspace / Alias for directories on other disks, aliases for directories you want to map to  

"C:/Users/IBM_ADMIN/IBM/rationalsdp/workspace/"
This is the absolute path to the directory.

Alias /radworkspace/ "C:/Users/IBM_ADMIN/IBM/rationalsdp/workspace/"

Now you can access the project in RAD under CD C through //localhost/radworkspace/.

4. Add a code at the same level as <ifModule alias_module>, as follows

<Directory "C:/Users/IBM_ADMIN/IBM/rationalsdp/workspace">  
    AllowOverride All  
    Options Indexes FollowSymLinks Includes ExecCGI  
    Require all granted   
</Directory>

Completed. Now restart Apache, visit: http://localhost/radworkspace/ That's all right.

Keywords: Redis PHP SELinux sudo

Added by NiGHTFiRE on Sun, 19 May 2019 13:34:18 +0300