VMwareworkstation 12.5
Xshell6_wm
CentOS-7-x86_64-Minimal-1804
非常重要:服务器禁止关机和重启
linux系统中,一切皆文件
1.执行:yum update
yum:Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
2.查询linux系统ip
ip addr
ifconfig (yum -y install net-tools)
3.系统目录结构
bin bin是Binary的缩写, 这个目录存放着最经常使用的命令。
dev
home 用户的主目录,在Linux中,每个用户都有一个自己的目录,一般该目录名是以用户的账号命名的。
lib64
mnt
proc
run
srv
tmp 这个目录是用来存放一些临时文件的。
var 这个目录中存放着在不断扩充着的东西,我们习惯将那些经常被修改的目录放在这个目录下。包括各种日志文件。
boot
etc 这个目录用来存放所有的系统管理所需要的配置文件和子目录。
lib
media
opt
root 该目录为系统管理员,也称作超级权限者的用户主目录。
sbin s就是Super User的意思,这里存放的是系统管理员使用的系统管理程序。
sys
usr 这是一个非常重要的目录,用户的很多应用程序和文件都放在这个目录下,类似于windows下的program files目录。
4.常用命令
cat chmod
chown find
mv(move) rm(remove)
cp touch
cd ls(ls -l)
pwd df
du ifconfig(yum -y install net-tools)
ping kill
ps clear
tar mkdir
l(linux)a(apache)m(mysql)p(php)安装
安装apache
yum安装apache(httpd):yum install -y httpd httpd-devel
显示complete(完毕)时,代表安装成功
启动apache服务
systemctl start httpd
重启apache服务
systemctl restart httpd
关闭apache服务
systemctl stop httpd
查看apache服务状态
systemctl status httpd
firewalld防火墙
开启
systemctl start firewalld
重启
systemctl restart firewalld
关闭
systemctl stop firewalld
查看状态
systemctl stauts firewalld
wget安装
yum install -y wget
mysql5.7安装
yum安装mysql5.7
1. 下载mysql源安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
2. 安装mysql源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
3. 安装mysql
yum install mysql-community-server
4. 管理mysql服务
启动mysql服务
systemctl start mysqld
重启mysql服务
systemctl restart mysqld
关闭mysql服务
systemctl stop mysqld
查看mysql服务状态
systemctl status mysqld
开机启动mysql服务
systemctl enable mysqld
systemctl daemon-reload
禁止开机启动mysql服务
systemctl disable mysqld
5. 修改默认密码
grep 'temporary password' /var/log/mysqld.log
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
set password for 'root'@'localhost'=password('MyNewPass4!');
编译安装PHP
1. 安装依赖扩展
yum -y install libxml2 libxml2-devel \
openssl openssl-devel bzip2 bzip2-devel \
libcurl libcurl-devel libjpeg libjpeg-devel \
libpng libpng-devel freetype freetype-devel \
gmp gmp-devel libmcrypt libmcrypt-devel \
readline readline-devel \
libxslt libxslt-devel gcc gcc-c++
2. 下PHP源码包
php.net/downloads.php
wget http://cn2.php.net/distributions/php-7.2.0.tar.gz
3. 解压源码包
tar -zxvf php-7.2.0.tar.gz
4. 进入解压后的目录
cd php7.2.0
5. 编译配置
./configure --prefix=/usr/local/php72 \
--with-config-file-path=/usr/local/php72/etc \
--with-apxs2=/usr/bin/apxs \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip
6. 编译并且安装
make && make install
配置httpd php
1. httpd
vim /etc/httpd/conf/httpd.conf
AllowOverride None 修改为 AllowOverride All
DirectoryIndex index.html 修改为 DirectoryIndex index.html index.php
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
# 添加下面一行
AddType application/x-httpd-php .php
重启httpd
systemctl restart httpd
2. php
cp /root/php-7.2.0/php.ini-development /usr/local/php72/etc/php.ini
vim /usr/local/php72/etc/php.ini
重启httpd
systemctl restart httpd