RedHat7.6_x86_x64服务器(最小化安装)搭建使用记录(二)

PostgreSQL数据库部署管理

1.rpm方式安装

挂载系统安装镜像:

root@localhost \~\]# mount /dev/cdrom /mnt 进入安装包路径: \[root@localhost \~\]# cd /mnt/Packages 依次安装如下程序包: \[root@localhost Packages\]# rpm -ihv postgresql-libs-9.2.7-1.el7.x86_64.rpm \[root@localhost Packages\]# rpm -ihv postgresql-9.2.7-1.el7.x86_64.rpm \[root@localhost Packages\]# rpm -ihv postgresql-server-9.2.7-1.el7.x86_64.rpm **2.初始化数据库并建立数据库和用户** 切换系统用户: \[root@localhost \~\]# su - postgres 初始化数据库: \[postgres@localhost \~\]$ initdb -D /var/lib/pgsql/data/ **3.数据库启停** 启动数据库: \[postgres@localhost \~\]$ pg_ctl -D /var/lib/pgsql/data start 停用数据库: \[postgres@localhost \~\]$ pg_ctl -D /var/lib/pgsql/data stop 重启数据库: \[postgres@localhost \~\]$ pg_ctl -D /var/lib/pgsql/data restart 查看数据库是否启动: \[postgres@localhost \~\]$ ps -A \| grep postgres 4.**数据库管理** 创建数据库: \[postgres@localhost \~\]$ createdb 数据库名 创建数据库用户: \[postgres@localhost \~\]$ createuser 用户名 访问数据库: \[postgres@localhost \~\]$ psql -d 数据库名 -U 用户名 使用"\\q"命令退出postgresql管理工具 查看postgresql使用的端口: \[postgres@localhost \~\]$ netstat -a \| grep postgresql postgresql数据目录:/var/lib/pgsql/data **5.数据库参数配置** ++/var/lib/pgsql/data目录下编辑postgresql.conf文件:++ listen_addresses = '\*' #将前面注释去掉并将值改为\* # PostgreSQL安装完成后,默认是只接受来在本机localhost的连接请求,此处将数据库服务器的监听模式修改为监听所有主机发出的连接请求 port = 5432 #将前面注释去掉 # 默认端口 ++/var/lib/pgsql/data目录下,修改pg_hba.conf文件,配置对数据库的访问权限:++ 在最后一行添加如下内容: host all all 192.168.61.0/24 trust 保存退出 ++修改默认数据库用户名登陆密码:++ su - postgres psql postgres=# \\password 提示修改密码。 ++*参数修改后,需要重启数据库*++

Apache+PHP环境搭建配置

Apache安装配置:

1.安装apache软件包

yum install httpd -y

2.启动apache服务

systemctl start httpd //开启服务

systemctl enable httpd //开机自启

3.Apache的配置

Apache主配置文件:/etc/httpd/conf/httpd.conf

ServerRoot "/etc/httpd" 用于指定Apache的运行目录

Listen 80 监听端口

DocumentRoot "/var/www/html" 网页文件的存放目录

<Directory "/var/www/html">

Require all granted 自定义目录权限

</Directory>

ErrorLog "logs/error_log" 错误日志存放位置

DirectoryIndex index.html 默认主页名称

PHP安装配置:

1.安装php

yum -y install php php-mysql

2.修改/etc/php.ini文件

cgi.fix_pathinfo=0

date.timezone = PRC

3.重启Apache服务

systemctl restart httpd

相关推荐
树℡独1 天前
ns-3仿真之应用层(五)
服务器·网络·tcp/ip·ns3
小小管写大大码1 天前
如何让vscode变得更智能?vscode接入claude实现自动编程
运维·ide·vscode·自动化·编辑器·ai编程·腾讯云ai代码助手
zhang133830890751 天前
CG-09H 超声波风速风向传感器 加热型 ABS材质 重量轻 没有机械部件
大数据·运维·网络·人工智能·自动化
a41324471 天前
ubuntu 25 安装vllm
linux·服务器·ubuntu·vllm
Configure-Handler1 天前
buildroot System configuration
java·服务器·数据库
津津有味道1 天前
易语言TCP服务端接收刷卡数据并向客户端读卡器发送指令
服务器·网络协议·tcp·易语言
Fᴏʀ ʏ꯭ᴏ꯭ᴜ꯭.1 天前
Keepalived VIP迁移邮件告警配置指南
运维·服务器·笔记
物联网软硬件开发-轨物科技1 天前
【轨物洞见】告别“被动维修”!预测性运维如何重塑老旧电站的资产价值?
运维·人工智能
程序员允诺1 天前
[DevOps实战] 彻底解决依赖地狱:如何编译全静态、可移植的 Xorriso 工具
运维·devops
酣大智1 天前
接口模式参数
运维·网络·网络协议·tcp/ip