systemctl

腾讯云CentOS7安装LNMP+wordpress

↘锁芯ラ 提交于 2020-01-10 00:23:19
许多云主机都有学生优惠,于是我趁着现在大一买了个腾讯1元云主机+免费cn域名(高中生的话就别想了)。鉴于我只知道用服务器安装博客,别的用途不了解,所以我就去安装wordpress。 而由于我看的教程有点问题,有的问题搜索引擎解决不了,我要么瞎折腾整好了,要么重装系统,最后一次挺顺利,半小时左右装好,但后续还有各种问题,一个个解决掉了。于是记录下来方便后(面要搭博客的)人。我参考的教程 阿里云Centos7安装LNMP环境和wordpress (有点坑,但还是不错的)。 LNMP=Linux+Nginx+MySQL+PHP 安装过程要选择y/n的都选y 忘记上一步输过什么可以用键盘的↑↓进行查看 句子后面的#表示注释 1.安装Nginx #yum install nginx #配置文件处于/etc/nginx #systemctl start nginx #启动nginx #systemctl enable nginx.service # 设置为开机启动 测试:123.206.57.252 打开公网IP可看到nginx的页面。 2.安装MySQL #rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm #yum repolist enabled | grep “mysql.

centos7网卡启动不了

天涯浪子 提交于 2020-01-09 16:44:22
网上查了很多资料了解网卡启动不了的原因,今天总结一下几种网卡启动不了的解决方案,以备参考。 systemctl restart network //重启网卡 返回报错: Restarting network (via systemctl): Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for details. 查看网卡状态 systemctl status network.service 会返回报错 :rtnetlink answers file exists 解决方法一: 大多人出现这个错误是因为虚拟机克隆导致的网卡mac冲突(因为我就是VMware的虚拟化环境,通过模块克隆多台服务器),修改ifcfg-eth0中HWADDR=新的mac或者删掉重启机器,最好删除或者注释掉。通过这样的方式基本上可以解决80%以上的网卡启动问题。 查看mac方法:ip addr 解决方法二: 如果安装了图形界面而NetworkManager这个服务没有关闭,也会导致网卡服务启动不了。(一般较少见) systemctl stop NetworkManager.service //关闭服务 systemctl disable NetworkManager

CentOS 7开启防火墙端口

 ̄綄美尐妖づ 提交于 2020-01-09 00:39:49
1.开启防火墙   systemctl start firewalld 2.添加   firewall-cmd --zone=public --add-port=80/tcp --permanent 3.重新载入   firewall-cmd --zone= public --query-port= 80/tcp 4.删除 firewall-cmd --zone= public --remove-port= 80/tcp --permanent 命令含义: --zone #作用域 --add-port=80/tcp #添加端口,格式为:端口/通讯协议 --permanent #永久生效,没有此参数重启后失效 3.firewall-cmd --reload 附上防火墙的基本使用 1、firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 : systemctl enable firewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。 启动一个服务:systemctl

Nginx 之 Rewrite

半世苍凉 提交于 2020-01-08 15:26:18
文章目录 一、环境准备 二、Rewrite 介绍 2.1、Rewrite跳转场景 2.2、Rewrite 实用场景 2.3、常用的正则表达式元字符 2.4、Rewrite 命令 2.5、location 分类 2.6、location 优先级 三、具体场景 3.1、场景一:基于域名的跳转 3.2、场景二:基于客户端IP地址访问跳转 3.3、场景三:基于旧、新域名跳转并加目录 3.4、场景四:基于参数匹配跳转 3.5、场景五:基于目录下所有php文件跳转 一、环境准备 一台nginx服务器提供 www.accp.com 的网页。 1、安装rpm源 rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm 2、直接用yum安装nginx和bind yum install nginx bind -y 3、DNS域名解析 vim /etc/named.conf vim /etc/named.rfc1912.zones ##复制添加一段 zone "accp.com" IN { type master; file "accp.com.zone"; allow-update { none; }; }; cd /var/named cp -p named

Firewalld 使用指南

女生的网名这么多〃 提交于 2020-01-07 20:05:04
阅读目录 1 firewalld的基本使用 2 配置firewalld-cmd 3 信任级别,通过Zone的值指定 4 firewall开启和关闭端口 5 管理服务 6 配置 IP 地址伪装 7 端口转发 8 使用systemd管理 回到顶部 1 firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 禁用,禁止开机启动: systemctl disable firewalld 停止运行: systemctl stop firewalld 回到顶部 2 配置firewalld-cmd 查看版本: firewall-cmd --version 查看帮助: firewall-cmd --help 显示状态: firewall-cmd --state 查看所有打开的端口: firewall-cmd --zone=public --list-ports 更新防火墙规则: firewall-cmd --reload 更新防火墙规则,重启服务: firewall-cmd --completely-reload 查看已激活的Zone信息: firewall-cmd --get-active-zones 查看指定接口所属区域: firewall-cmd --get-zone-of-interface

yum 安装 tomcat

社会主义新天地 提交于 2020-01-07 13:16:58
前言 对于一个新安装的 centos 系统来说,是没有 tomcat 服务器的。用下面的命令可以查看 tomcat 服务的状态。 systemctl status tomcat.service //或者 systemctl status tomcat 1 2 3 效果如下: 可以看到不能找到 tomcat.service , 这就证明这台机器上没有 tomcat 服务。 下面我们就来安装 tomcat 服务,并且把它运行起来。 安装 tomcat 我们选择用 yum 来安装 tomcat , 安装命令如下: yum install tomcat //或者 yum -y install tomcat 1 2 3 第二个命令 -y 代表遇到询问都选 y , 这个是一步操作。 安装完成后,安装目录在 "/usr/share/tomcat" , 我们用 cd 命令切到这个目录,用 ls 命令查看这个目录里面的文件,如下所示: 现在 tomcat 已经安装好了,通过 systemctl status tomcat 命令查看一下 tomcat 的状态。效果如下: tomcat 现在处于 dead(死亡) 状态,服务还没有跑起来。 运行 tomcat 我们用以下命令来启动 tomcat. systemctl start tomcat.service //或者 systemctl start

linux任务计划, chkconfig工具,systemd管理服务, unit介绍,target介绍

强颜欢笑 提交于 2020-01-07 07:33:41
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> linux任务计划: 一. Crontab 介绍 crontab命令的功能是在一定的时间间隔调度一些命令的执行。 二.查看/etc/crontab文件 vi /etc/crontab 三.文件/etc/crontab中每行任务的描述格式如下: minute hour day month dayofweek command minute - 从0到59的整数 hour - 从0到23的整数 day - 从1到31的整数 (必须是指定月份的有效日期) month - 从1到12的整数 (或如Jan或Feb简写的月份) dayofweek - 从0到7的整数,0或7用来描述周日 (或用Sun或Mon简写来表示) command - 需要执行的命令(可用as ls /proc >> /tmp/proc或 执行自定义脚本的命令) root表示以root用户身份来运行 run-parts表示后面跟着的是一个文件夹,要执行的是该文件夹下的所有脚本 对于以上各语句,星号(*)表示所有可用的值。例如*在指代month时表示每月执行(需要符合其他限制条件)该命令。 整数间的连字号(-)表示整数列,例如1-4意思是整数1,2,3,4 (范围) 指定数值由逗号分开。如:3,4,6,8表示这四个指定整数。(指定某几个数字) 符号“/

CentOS 7启用或禁用启动项

若如初见. 提交于 2020-01-07 05:15:34
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 检查服务是否启动 在 RHEL/CentOS 7 上,通过使用 systemctl 命令检查,可以运行 systemctl status 命令检查服务的运行状态: $ systemctl status httpd httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled) ... 最后一个单词 enabled 或者 disabled 会告诉我们服务的状态,在以上的示例中, Apache2 Web 服务器的 httpd 服务是启用的。 禁用/移除服务 如果要禁用服务,可以使用 systemctl disable 命令: $ systemctl disable httpd rm '/etc/systemd/system/multi-user.target.wants/httpd.service' $ systemctl status httpd httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled) ... 运行

systemctl command

蓝咒 提交于 2020-01-07 05:14:48
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> systemctl命令 是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。 任务 旧指令 新指令 使某服务自动启动 chkconfig --level 3 httpd on systemctl enable httpd.service 使某服务不自动启动 chkconfig --level 3 httpd off systemctl disable httpd.service 检查服务状态 service httpd status systemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅显示是否 Active) 显示所有已启动的服务 chkconfig --list systemctl list-units -- type =service 启动某服务 service httpd start systemctl start httpd.service 停止某服务 service httpd stop systemctl stop httpd.service 重启某服务 service httpd restart systemctl restart httpd

CentOS 6.x 和 CentOS 7.x 中 Nginx 的操作命令(启动/重启/退出/...)

流过昼夜 提交于 2020-01-07 01:43:01
CentOS 6.x 和 CentOS 7.x 中 Nginx 的操作命令(启动/重启/退出/...) --------- CentOS 6.x 中 Nginx 的操作命令 --------- # nginx // 不指定配置文件启动 Nginx,默认读取 /etc/nginx/nginx.conf 配置文件。 # nginx -c <配置文件> // 指定配置文件启动 Nginx 。 # nginx -t // 测试配置文件是否有语法错误,通过这种方式,也就知道了默认配置文件是哪个文件。 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful # nginx -s reopen // 重启 Nginx # nginx -s reload // 重新加载 Nginx 配置文件,然后以优雅的方式重启 Nginx 。 # nginx -s stop // 强制停止 Nginx 服务 # nginx -s quit // 优雅地停止 Nginx 服务(即处理完所有请求后再停止服务) --------- CentOS 7.x 中 Nginx 的操作命令 --------- #