CentOS7安装php类型CMS(Mariadb10.5)

CentOS7安装php类型CMS(Mariadb10.5)

测试环境

# uname -a
Linux localhost.localdomain 3.10.0-1160.15.2.el7.x86_64 #1 SMP Wed Feb 3 15:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/redhat-release 

CentOS Linux release 7.9.2009 (Core)

# php -v 
php-fpm -vPHP 7.2.34 (cli) (built: Oct  1 2020 13:37:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.34, Copyright (c) 1999-2018, by Zend Technologies

# php-fpm -v
PHP 7.2.34 (fpm-fcgi) (built: Oct  1 2020 13:40:44)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.34, Copyright (c) 1999-2018, by Zend Technologies

# mariadb --version
mariadb  Ver 15.1 Distrib 10.5.8-MariaDB, for Linux (x86_64) using readline 5.1

继续阅读

CentOS7 Lsyncd 文件实时同步(替代Rsync和Inotify)

Lsyncd结合了inotify + rsync,Lsyncd监视本地目录树事件监视器接口(inotify或fsevents)。它聚合和组合事件几秒钟,然后生成一个(或多个)进程(es)来同步更改。

部署环境

# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

# uname -a                
Linux filesync-20.203.localdomain 3.10.0-693.11.1.el7.x86_64 #1 SMP Mon Dec 4 23:52:40 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
    
# rsync --version   
rsync  version 3.0.9  protocol version 30
Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.
    
# lsyncd --version         
Version: 2.2.2

  安装部署 lsyncd

部署机器

Server-A  192.168.20.203   [主文件服务器,  读写]
Server-B  192.168.20.204   [备份文件服务器,只读]

密钥登录

Server-A服务器上操作

#生成密钥文件
ssh-keygen -t rsa
#将公钥拷贝到B
ssh-copy-id username@192.168.20.204
#测试
ssh username@192.168.20.204

安装 lsyncd

yum -y install lsyncd

配置文件

settings {
    logfile    = "/tmp/lsyncd.log",
    statusFile = "/tmp/lsyncd.status",
    insist = true,
    statusInterval = 10
}
sync {
    default.rsyncssh,
    source="/data",
    host="username@192.168.20.204",
    targetdir="/data",
    rsync = {
        archive = true,
        compress = false,
        whole_file = false,
        _extra = {"--bwlimit=40960"}
    },
    ssh = {
        port = 22
    }
}

测试

lsyncd -nodaemon /etc/lsyncd.conf

后台启动 lsyncd

systemctl start lsyncd
systemctl enable lsyncd

系统优化

echo -e "\nfs.inotify.max_user_watches = 8192000" >> /etc/sysctl.conf 
sysctl -p

参考文档

CentOS6 LVM 管理

CentOS6 LVM 管理

添加磁盘到LVM

fdisk /dev/vdb
n

t # 磁盘id设置为 8e ,Linux LVM


 umount /data
 fdisk /dev/vdb
 vgdisplay 
 d
 vgextend VolGroup /dev/vdb1 
 vgdisplay 
 lvextend -L +490G /dev/VolGroup/lv_root 
 lvdisplay 
 resize2fs /dev/VolGroup/lv_root 
 df 
 df -h
 vi /etc/fstab 

参考文档

使用sed删除匹配行及上下几行

删除包含DATA Partition的行,同时删除这行的后面2行和上面3行
sed -i ‘/DATA Partition/,+2d;:go;1,3!{P;N;D};N;bgo’ report.cfg

参考文档:
sed ‘/5/,+3d;:go;1,2!{P;N;D};N;bgo’ file
/5/,+3d 对匹配到5的那一行以及该行的后三行都执行d操作(d 清空模式空间)
:go 设一个标签go
1,2!{P;N;D} 除了第一行和第二行,其他行都执行P;N;D操作(P 打印当前模式空间的第一行;N 将下一行添加到当前模式空间中;D 删除模式空间的第一行并开始一个新的循环)
N 这个命令只对第一行和第二行有效了,因为其他行在上一个命令中都执行了D,直接开始新的循环了,所以这个命令不会被执行。
bgo 返回go标签

http://bbs.chinaunix.net/thread-3775201-1-1.html

 

CentOS6 安装Webmin

官网:http://www.webmin.cn/download.html
参考:http://spikedighole.blog.163.com/blog/static/176998045201562805435418/

# uname -a                
Linux localhost.localdomain 2.6.32-573.18.1.el6.x86_64 #1 SMP Tue Feb 9 22:46:17 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release 
CentOS release 6.7 (Final)
# rpm -qa|grep webmin
webmin-1.780-1.noarch


# webadmin安装升级会用到perl-Net-SSLeay
yum -y install perl-Net-SSLeay
# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.740-1.noarch.rpm
wget http://jaist.dl.sourceforge.net/project/webadmin/webmin/1.780/webmin-1.780-1.noarch.rpm
rpm -ivh webmin-1.780-1.noarch.rpm 
netstat -ntlp|grep 10000

 

转:使用 /sys 文件系统访问 Linux 内核

sysfs 虚拟文件系统提供了一种比 proc 更为理想的访问内核数据的途径

sysfs 是 Linux 内核中设计较新的一种虚拟的基于内存的文件系统,它的作用与 proc 有些类似,但除了与 proc 相同的具有查看和设定内核参数功能之外,还有为 Linux 统一设备模型作为管理之用。相比于 proc 文件系统,使用 sysfs 导出内核数据的方式更为统一,并且组织的方式更好,它的设计从 proc 中吸取了很多教训。本文就 sysfs 的挂载点 /sys 目录结构、其与 Linux 统一设备模型的关系、常见属性文件的用法等方面对 sysfs 作入门介绍,并且就内核编程方面,以具体的例子来展示如何添加 sysfs 支持。

详见  https://www.ibm.com/developerworks/cn/linux/l-cn-sysfs/

centos 6 如何动态识别新插入物理磁盘(一) http://afatech.iteye.com/blog/2278379

CentOS 使用lynx更新3322.org DDNS

参考文档:
http://www.pubyun.com/products/dyndns/download/

# 安装lynx
# yum install lynx

# lynx -mime_header -auth=hahaha:2016! "http://members.3322.net/dyndns/update?system=dyndns&hostname=hahaha.f3322.net"
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 23 Feb 2016 09:12:23 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
Vary: Cookie

good 16.26.19.26
#
# 
# lynx -mime_header -auth=hahaha:2016! "http://members.3322.net/dyndns/update?system=dyndns&hostname=hahaha.f3322.net"
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 23 Feb 2016 09:14:00 GMT
Content-Type: text/plain; charset=utf-8
Connection: close
Vary: Cookie

nochg 16.26.19.26

 

CentOS6 安装phpMyAdmin

# cat /etc/redhat-release 
CentOS release 6.7 (Final)
# rpm -qa|grep phpMyAdmin
phpMyAdmin-4.0.10.14-1.el6.noarch
# rpm -qa|grep mysql-server
mysql-server-5.1.73-5.el6_6.x86_64

# 添加epel源
# rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm

# 安装相关软件包
# yum -y install httpd mysql php php-mysql phpmyadmin

# 修改index文件
# vi /etc/httpd/conf/httpd.conf 
DirectoryIndex index.php index.html index.html.var

# 允许远程登录phpMyAdmin
# vi /etc/httpd/conf.d/phpMyAdmin.conf 
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 1.1.1.2
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
   
# 重启httpd
service httpd restart

# 登录
http://server_ip/phpmyadmin/