CentOS7 yum 安装LAMP

最近把vps系统重新安装了一下,更换了系统模版为CentOS7。命令和CentOS6有所不同。

1、更新系统

yum makecache fast
yum update

2、安装apache

yum install httpd

3、安装数据库mariadb

yum install mariadb mariadb-server mariadb-devel

4、安装php和常用库

php php-devel php-common php-cli php-mbstring php-gd php-bcmath php-pdo php-pear php-xml php-xmlrpc php-mysqlnd

5、启动httpd、mysqld

systemctl start httpd.service
systemctl start mariadb.service

6、设置开机自启动服务

systemctl enable httpd.service
systemctl enable mariadb.service

7、配置apache

vim /etc/httpd/conf/httpd.conf

1)添加php支持
找到:

DirectoryIndex index.html

改为:

DirectoryIndex index.html index.php

找到:

AddType application/x-gzip .gz .tgz

在其下面加上以下内容:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

2)添加伪静态

<Directory "/home/live-in.org">
    AllowOverride All
    # Allow open access:
    Require all granted
</Directory>


3)在文件末尾添加虚拟主机配置

<VirtualHost *:80>
DocumentRoot "/home/live-in.org"
ServerName www.live-in.org
ErrorLog logs/live-in.org-error_log
CustomLog logs/live-in.org-access_log common
DeflateCompressionLevel 5
AddOutputFilterByType DEFLATE text/html text/css text/javascript application/x-javascript
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName xxx.xxx.xxx.xxx
</VirtualHost>


PS:xxx.xxx.xxx.xxx填服务器IP

4)调整prefork进程数

<IfModule mpm_prefork_module>
    StartServers          2
    MinSpareServers       2
    MaxSpareServers       3
    MaxClients            4
    MaxRequestsPerChild  500
</IfModule>

oracle简单运维

oracle数据库磁盘满了,常用的处理方法:
1)清空无用的大表
2)删除日志
3)转移表空间文件

一、准备工作
0、切换到oracle用户

su - oracle

1、查看oracle安装目录

echo $ORACLE_HOME
/u01/oracle/product/10.2.0/db_1

2、查看实例名称

echo $ORACLE_SID
pbcssit

二、清空无用的大表
1、查看数据占用大小

select * from dba_segments where owner = 'NPBCS';

plsql在BYTES列,右键 – Column Totals – Sum

可以看到数据占用了6G多的空间

建议:按照BYTES大小降序排列,查看是否有历史表、临时表可以清空

2、查看表空间文件

select * from dba_data_files;

查看表空间文件占用磁盘大小,关闭自增功能,修改AUTOEXTENSIBLE为NO
因为有些表自动扩展是无限制的,会把磁盘都占满,测试环境可以把表空间初始值设置的大一点,如果满了手工添加

3、查看表空间剩余大小

select * from dba_free_space;

三、删除日志
1、cd到oracle安装目录下

du -sh *
4.8M	adump
5.5G	bdump
73M	cdump
8.0K	dpdump
8.0K	pfile
3.0G	udump


删除365天前的文件:

find . -name "*" -mtime +365 -exec rm -rf {} \;

四、转移表空间文件
通过软链接把表空间文件移动到有空闲空间的磁盘。

五、oracle状态查询
1、查看oracle自有进程

ps -ef | grep ora_

2、查看oracle SID

echo $ORACLE_SID

3、查看oracle安装目录

echo $ORACLE_HOME

4、查看oracle连接数

ps -ef | grep oracle

看 (LOCAL=NO) 数量,表示不是本地连接,为外部连接进来的

5、查看系统session数量

select * from v$session;

6、查看参数文件配置

select * from v$parameter;