CentOS 7 Systemd PHP
CentOS 7 Systemd 預設會打開 PrivateTmp 需要將它關掉才能與其他服務共用 /tmp
Close Systemd PHP Private Tmp
/usr/lib/systemd/system/php-fpm.service
PrivateTmp=false
Save reload daemon
systemctl daemon-reload
Restart php-fpm
systemctl restart php-fpm.service
Getting MySQL path in command prompt
select @@basedir
select @@datadir
ref:
https://stackoverflow.com/questions/14805567/getting-mysql-path-in-command-prompt
select @@datadir
ref:
https://stackoverflow.com/questions/14805567/getting-mysql-path-in-command-prompt
VirtualBox CentOS 加大硬碟空間
1. 關閉虛擬機器
poweroff
2. 以指令增加資料卷容量
VBoxManage modifyhd "D:\VDI\CentOS7.vdi" --resize 40960 (40G)
3. 虛擬機器設定 EFI 開機並掛載 GParted
https://downloads.sourceforge.net/project/gparted/gparted-live-stable/0.31.0-1/gparted-live-0.31.0-1-i686.iso
5. 進入系統取得 LV Path
lvdisplay
6. 重新大小 LV Path
lvresize -l +100%FREE /dev/centos/root
7. 重新大小 xfs
xfs_growfs /dev/centos/root
ref:
http://oldgrayduck.blogspot.com/2016/07/virtualbox-centos.html
poweroff
2. 以指令增加資料卷容量
VBoxManage modifyhd "D:\VDI\CentOS7.vdi" --resize 40960 (40G)
3. 虛擬機器設定 EFI 開機並掛載 GParted
https://downloads.sourceforge.net/project/gparted/gparted-live-stable/0.31.0-1/gparted-live-0.31.0-1-i686.iso
4. 使用 GParted 開機並 Resize 磁區後 Apply 關機, 取消虛擬機器的 EFI 開機並載卸 GParted
lvdisplay
6. 重新大小 LV Path
lvresize -l +100%FREE /dev/centos/root
7. 重新大小 xfs
xfs_growfs /dev/centos/root
ref:
http://oldgrayduck.blogspot.com/2016/07/virtualbox-centos.html
MySQL Get Tree Parents, Childrens
// get childrens
SELECT GROUP_CONCAT(lv SEPARATOR ',') as childrens
FROM
(
SELECT @pv:=( SELECT GROUP_CONCAT( uid SEPARATOR ',' ) FROM __table__ WHERE parent_id IN ( @pv ) ) AS lv
FROM __table__
JOIN ( SELECT @pv:='__parent_id__' ) tmp
WHERE parent_id IN (@pv)
) a;
// get parents
SELECT
`_id` AS `file_id`,
`q`.`parent_id`,
(SELECT name FROM files AS `r` WHERE `r`.`file_id` = `q`.`_id` ) AS `name`
FROM
( SELECT @r AS `_id`, ( SELECT @r := `parent_id` FROM `files` WHERE `file_id` = `_id` ) AS `parent_id` FROM ( SELECT @r := '__id__', @l := '0' ) AS `vars`, `files` WHERE @r <> '0' ) AS `q`
SELECT GROUP_CONCAT(lv SEPARATOR ',') as childrens
FROM
(
SELECT @pv:=( SELECT GROUP_CONCAT( uid SEPARATOR ',' ) FROM __table__ WHERE parent_id IN ( @pv ) ) AS lv
FROM __table__
JOIN ( SELECT @pv:='__parent_id__' ) tmp
WHERE parent_id IN (@pv)
) a;
// get parents
SELECT
`_id` AS `file_id`,
`q`.`parent_id`,
(SELECT name FROM files AS `r` WHERE `r`.`file_id` = `q`.`_id` ) AS `name`
FROM
( SELECT @r AS `_id`, ( SELECT @r := `parent_id` FROM `files` WHERE `file_id` = `_id` ) AS `parent_id` FROM ( SELECT @r := '__id__', @l := '0' ) AS `vars`, `files` WHERE @r <> '0' ) AS `q`
Change Nginx UID and GID
stop nginx
stop php-fpm
usermod -u 1500 nginx
groupmod -g 1500 nginx
find / -user 998 -exec chown -h 1500 {} \;
find / -group 996 -exec chgrp -h 1500 {} \;
usermod -g 1500 nginx
start nginx
start php-fpm
假如 nginx UID/GID 未取代完成會造成錯誤
stop php-fpm
usermod -u 1500 nginx
groupmod -g 1500 nginx
find / -user 998 -exec chown -h 1500 {} \;
find / -group 996 -exec chgrp -h 1500 {} \;
usermod -g 1500 nginx
start nginx
start php-fpm
假如 nginx UID/GID 未取代完成會造成錯誤
CentOS 7 Install NFS Server and Windows 10 NFS Client to Connect
CentOS
1. yum install
yum install nfs-utils
2. systemctl start and enable
systemctl enable rpcbind
systemctl enable nfs-server
systemctl start rpcbind
systemctl start nfs-server
3. create folder and change mod
mkdir /myshare
chmod 777 /myshare
4. edit /etc/exports and reload exportfs
vi /etc/exports
/myshare 192.168.124.0/24(rw,sync,no_root_squash)
exportfs -r
5. close SELiux
vi /etc/sysconfig/selinux
SELINUX=disabled
6. add firewall rule and reload
firewall-cmd --permanent --zone public --add-service mountd
firewall-cmd --permanent --zone public --add-service rpc-bind
firewall-cmd --permanent --zone public --add-service nfs
firewall-cmd --reload
Windows 10
1. 開啟 Windwos 功能
2. 安裝 Service of NFS 全部
3. 開啟 cmd
4. 掛載 NFS
mount -o anon \\remote_ip_address\myshare z:
訂閱:
文章 (Atom)