安装 PostgreSQL
sudo apt-get -y install postgresql
创建存放表空间目录
sudo mkdir -p /usr/local/freeswitch/db/psdb
sudo chown postgres:postgres /usr/local/freeswitch/db/psdb
修改监听IP
sudo vim /etc/postgresql/9.5/main/postgresql.conf
做如下修改
listen_addresses = '*'
对所有网段全开放:
sudo vim /etc/postgresql/9.5/main/pg_hba.conf
#IPV4
host all all 0.0.0.0/0 md5
#IPV6
host all all ::/0 md5
重启ps
sudo /etc/init.d/postgresql restart
修改PostgreSQL密码
sudo su - postgres
postgres@ubuntu:~$ psql
postgres@ubuntu:~$ psql
psql (9.5.8)
Type "help" for help.
postgres=# \password
Enter new password:
Enter it again:
建数据库
创建角色
postgres=# create role freeswitch createdb createrole login password '123456';
创建表空间
postgres=# create tablespace freeswitch_space owner freeswitch location '/usr/local/freeswitch/db/psdb';
CREATE TABLESPACE
切换角色并创建数据库
postgres=# set session authorization freeswitch;
SET
postgres=> create database freeswitch_core tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database sofia_reg_internal tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database sofia_reg_external tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database sofia_reg_internal6 tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database sofia_reg_external6 tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database call_limit tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database fifo tablespace freeswitch_space ;
CREATE DATABASE
建立新用户、角色
postgres=> create user freeswitch_core password '123456' createdb;
CREATE ROLE
postgres=>
使用新用户登入freeswitch_core数据库
postgres=> \q
postgres@ubuntu:~$ psql -U freeswitch_core -h localhost -d freeswitch_core
修改fs配置后重启
sudo vim /usr/local/freeswitch/conf/autoload_configs/switch.conf.xml
<param name="core-db-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='freeswitch_core' user='freeswitch_core' password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />
sudo vim /usr/local/freeswitch/conf/sip_profiles/internal.xml
<param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='sofia_reg_internal' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />
sudo vim /usr/local/freeswitch/conf/sip_profiles/internal-ipv6.xml
<param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='sofia_reg_internal6' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />
sudo vim /usr/local/freeswitch/conf/sip_profiles/external.xml
<param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='sofia_reg_external' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />
sudo vim /usr/local/freeswitch/conf/sip_profiles/external-ipv6.xml
<param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='sofia_reg_external6' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />
sudo vim /usr/local/freeswitch/conf/autoload_configs/db.conf.xml
<param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='call_limit' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />
sudo vim /usr/local/freeswitch/conf/autoload_configs/fifo.conf.xml
<settings>
<param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='fifo' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />
</settings>
您的支持,是我持续创作的动力!!!!