Software installation, set up and update CentOS LAMP environment under Linux source

• Linux software installed at
Yum / rpm / Source installed
a yum install:

yum search name search software package in source 
yum install software packages were installed 
yum remove the software name = yum erase the name of the software to uninstall the specified software

. b rpm installation:
Information rpm query software:

RPM - qa query all installed software 
RPM -qa | grep ssh ssh service queries whether the installed 
RPM - QL software name lists all of the software files and directory where the full file name 
RPM - qR Software name list associated with the software the files contained dependent software 
RPM -HIV install the software name software (download the software in advance)

-i .rpm file to install specified
-h to see the progress
-v displays detailed information about the installation process
-U rpm file using the upgrade
-r uninstall the software

install nginx
step1: install nginx library

http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

step2: yum install nginx

yum install nginx

Open service

service nginx start

step3: View the status of port 80

netstat -ntulp | grep 80 

step4: access the virtual machine ip, you need to turn off the firewall

systemctl stop firewalld.service

c source installation:.
./configure Configuration (if necessary to specify the installation path: ./ cofigure --prefix = / Home /)
./make compile the code
./make install installation default installation path / usr / local / bin

WAMP, LAMP, LNMP environment Introduction

• WAMP environment, install apache, mysql, phpstudy three software environment windows

• LAMP environment, install apache, mysql, php three software in linux environment, but also need to install their plug-middle

• LNMP=linux+nginx+mysql+php

LAMP environment to build:
: link
building LAMP environment Ubuntu18:
https://www.cnblogs.com/opsprobe/p/9126411.html

specific method:

Apache2 web server is installed:

It can update server (optional)

1, sudo apt update # Get the latest Resource Kit

2, sudo apt upgrade # All this software update

3, sudo apt dist-upgrade # software update system of the present

Prompt, the following operations are carried out by the root authority

# Install Apache

apt install apache2

# Check for open Apache, usually installed after the meeting turned on by default.

systemctl status apache2

# Open, close and restart the Apache server

. 1 , open systemctl Start apache2 # 

2 , # systemctl STOP apache2 closed 

. 3 , # apache2 restart the restart systemctl

Now access to your Web server, open a browser and enter the IP address of Ubuntu18.04, nothing else will be able to access Apache's default page.

Second, the database is installed, this installation MySQL5.7:

 

# See if there install MySQL:

 

dpkg -l | grep mysql

 

# Install MySQL:

 

apt install mysql-server

 

 

After the installation is complete, you can use the following command to check whether the installation was successful:

 

netstat -tap | grep mysql

 

After inspection by the above command, you see if the mysql socket in the LISTEN state indicates a successful installation.

 

 

Log mysql database via the following command:

 

mysql -u root -p

 

-u user name indicating the selection of landing, -p represents a user password, now is the mysql database without a password, Enter password: directly at Enter, you can enter the mysql database.

 

Then show databases; you can view all current database.

 

 

Next, in order to ensure the safety and normal operation of the database, the database initialization. This initialization operation involves the following five steps.

 

(1) installation verification password plugin.

 

(2) Set the root proprietary database administrator password.

 

(3) subsequently removed anonymous account and log in as root from a remote database administrator to ensure the safety of the operation on the database business.

 

(4) delete the default test database, canceled a series of test access to the database.

 

(5) to refresh the authorization list, let initialization settings take effect immediately.

 

对于上述数据库初始化的操作步骤,在下面的输出信息旁边我做了简单注释。

 

root@ubuntu-virtual-machine:~# mysql_secure_installation


Securing the MySQL server deployment.


Connecting to MySQL using a blank password.


VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?    # 要安装验证密码插件吗?


Press y|Y for Yes, any other key for No: N    # 这里我选择N
Please set the password for root here.


New password:   # 输入要为root管理员设置的数据库密码


Re-enter new password:   # 再次输入密码



By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.


Remove anonymous users? (Press y|Y for Yes, any other key for No) : y     # 删除匿名账户
Success.



Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.


Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N    # 禁止root管理员从远程登录,这里我没有禁止


... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.



Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y   # 删除test数据库并取消对它的访问权限
- Dropping test database...
Success.


- Removing privileges on test database...
Success.


Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.


Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y   # 刷新授权表,让初始化后的设定立即生效
Success.


All done!

 

 

 

检查mysql服务状态:

 

systemctl status mysql

 

显示如下结果说明mysql服务运行是正常的:

 

 

再次用mysql -u root -p命令,Enter password:处输入刚设置的密码,回车,就能够进入mysql数据库。

 

使用 use mysql; 命令打开mysql命名的数据库,显示当前数据库的表:show tables; 查询user表里的数据:select * from user;(user表里是mysql数据库的所有账户信息)

 

 

现在配置mysql允许远程访问,首先编辑 /etc/mysql/mysql.conf.d/mysqld.cnf 配置文件:

 

vim /etc/mysql/mysql.conf.d/mysqld.cnf

 

注释掉bind-address          = 127.0.0.1

 

 

保存退出,然后进入mysql数据库,执行授权命令:

 

mysql -u root -p


mysql> grant all on *.* to root@'%' identified by '你的密码' with grant option;


mysql> flush privileges;    # 刷新权限


mysql> exit


然后执行exit命令退出mysql服务,再执行如下命令重启mysql:


systemctl restart mysql


现在Windows下可以使用Navicat图形化工具远程连接Ubuntu下的MySQL数据库,输入刚授权远程权限的密码。

 

这里顺便再分享下:Navicat for MySQL 10.1.7安装包

 

链接:https://pan.baidu.com/s/1CyDXr79v7Ufc60fv_XQ_gA ,提取码:ohf8

 

 

OK,到这里Ubuntu18.04下安装MySQL已经完成了。

 

三、PHP的安装:

PHP添加了支持动态网页的服务器端网页处理。

运行以下命令安装PHP。

apt install php

测试PHP,查看版本:

php -v

 

接下来,我们需要告诉Apache首先提供PHP页面。

打开 /etc/apache2/mods-enabled/dir.conf 文件并将其更改为首先列出index.php。

默认:

 更改为:

修改配置文件以后,我们需要重新启动一下Apache服务器。

systemctl restart apache2

在/var/www/html中创建一个名为index.php的新文件。

vim /var/www/html/index.php

输入以下内容

<?php
phpinfo();
?>

保存并退出该文件。

打开浏览器并输入Ubuntu18.04的IP地址,不出意外就能访问到PHP的默认信息页面。

现在在IP地址后面输入/index.html也能访问到Apache的默认信息页面。

四、安装PHP模块(可选)

最有可能的是,当您安装基于PHP的应用程序时,它将具有PHP模块依赖性。

一个常见的PHP模块是php-curl模块。

我们可以用apt来安装这些,只需在您需要安装的模块前面添加“php-”。

apt install php-curl

如果您在查找所需的模块时遇到问题,只需输入“apt install php”(模块的第一个字母),然后按下TAB键,Ubuntu将为您列出所有匹配的包,如下图所示:

# apt install php-c

注意:下面的是putty远程Ubuntu18.04的截图,按TAB键,在Ubuntu18.04的终端下不知道为什么没反应,用putty远程Ubuntu18.04可以列出所有匹配的包,

五、phpMyAdmin 的安装(可选,主要可以通过它的 Web 界面来执行所有与数据库管理和其他数据库操作相关的任务):

安装命令:

apt install phpmyadmin

 

选择 Apache2 并点击确定。(以下的选择用TAB键)

 点击确定来配置 phpMyAdmin 管理的数据库。

 指定 phpMyAdmin 向数据库服务器注册时所用的密码。

再次确认密码。

 出现如下图所示,就表示phpMyAdmin安装完毕了。

安装完成后,创建phpMyAdmin的软链接到Apache的根目录下(我的是/var/www/html/)

ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

现在开始尝试访问phpMyAdmin,打开浏览器并输入:IP地址/phpmyadmin

注释:phpMyAdmin 是一个以PHP为基础,以Web-Base方式架构在网站主机上的MySQL的数据库管理工具,让管理者可用Web接口管理MySQL数据库。借由此Web接口可以成为一个简易方式输入繁杂SQL语法的较佳途径,尤其要处理大量资料的汇入及汇出更为方便。其中一个更大的优势在于由于phpMyAdmin跟其他PHP程式一样在网页服务器上执行,但是您可以在任何地方使用这些程式产生的HTML页面,也就是于远端管理MySQL数据库,方便的建立、修改、删除数据库及资料表。也可借由phpMyAdmin建立常用的php语法,方便编写网页时所需要的sql语法正确性。

摘自:https://www.cnblogs.com/opsprobe/p/9126411.html

更新CentOS7的yum源
1. 备份自带的源
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2. 下载源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3. Yum makecache 生成缓存
4. 安装软件:yum -y install 软件名称
      yum -y update 更新系统

Guess you like

Origin www.cnblogs.com/wasabiblog/p/11575466.html