美文网首页
Misago安装

Misago安装

作者: mountain369 | 来源:发表于2018-08-01 13:03 被阅读0次

    Misago is fully featured forum application written in Python and ES6, powered by Django and React.js [http://misago-project.org](http://misago-project.org)

    Documentation:  https://misago.gitbook.io/docs/

    1. setup misago

    pip install misago

    misago-start.py misagoforumorg

    2. install  PostgreSQL

    2.1  download package

         from: https://ftp.postgresql.org/pub/source/

    Note:这个网址有时候很快,有时候很慢

    2.2 install postgresql

    [root@localhost download]# tar xvf postgresql-9.4.9.tar.gz

    [root@localhost download]# ls

    postgresql-9.4.9  postgresql-9.4.9.tar.gz

    [root@localhost postgresql-9.4.9]# ./configure --prefix=/usr/local/pgsql

    [root@localhost postgresql-9.4.9]# gmake

    [root@localhost postgresql-9.4.9]# gmake install

    2.3 安装PG插件

    [root@localhost contrib]# pwd

    /root/download/postgresql-9.4.9/contrib

    [root@localhost contrib]# gmake;gmake install

    2.4 加载动态库

    echo "/usr/local/pgsql/lib" >> /etc/ld.so.conf.d/pgsql.conf

    ldconfig

    2.5 创建用户postgres

    [root@localhost contrib]# useradd postgres

    [root@localhost contrib]# echo "postgres"|passwd --stdin postgres

    Changing password for user postgres.

    passwd: all authentication tokens updated successfully.

    2.6 创建PG数据目录

    [root@localhost contrib]# mkdir -p /data/pg/data

    [root@localhost contrib]# chown -R postgres:postgres /data/pg

    2.7 初始化数据库

    [root@localhost contrib]# su postgres

    [postgres@localhost contrib]$ /usr/local/pgsql/bin/initdb --no-locale -U postgres -E utf8 -D /data/pg/data -W

    could not change directory to "/root/download/postgresql-9.4.9/contrib": Permission denied

    The files belonging to this database system will be owned by user "postgres".

    This user must also own the server process.

    The database cluster will be initialized with locale "C".

    The default text search configuration will be set to "english".

    Data page checksums are disabled.

    fixing permissions on existing directory /data/pg/data ... ok

    creating subdirectories ... ok

    selecting default max_connections ... 100

    selecting default shared_buffers ... 128MB

    selecting dynamic shared memory implementation ... posix

    creating configuration files ... ok

    creating template1 database in /data/pg/data/base/1 ... ok

    initializing pg_authid ... ok

    Enter new superuser password:

    Enter it again:

    setting password ... ok

    initializing dependencies ... ok

    creating system views ... ok

    loading system objects' descriptions ... ok

    creating collations ... ok

    creating conversions ... ok

    creating dictionaries ... ok

    setting privileges on built-in objects ... ok

    creating information schema ... ok

    loading PL/pgSQL server-side language ... ok

    vacuuming database template1 ... ok

    copying template1 to template0 ... ok

    copying template1 to postgres ... ok

    syncing data to disk ... ok

    WARNING: enabling "trust" authentication for local connections

    You can change this by editing pg_hba.conf or using the option -A, or

    --auth-local and --auth-host, the next time you run initdb.

    Success. You can now start the database server using:

        /usr/local/pgsql/bin/postgres -D /data/pg/data

    or

        /usr/local/pgsql/bin/pg_ctl -D /data/pg/data -l logfile start

    备注

    initdb [选项]... [DATADIR]

    -A, --auth=METHOD 本地连接的默认认证方法

    -D, --pgdata=DATADIR 当前数据库簇的位置

    -E, --encoding=ENCODING 为新数据库设置默认编码

    --locale=LOCALE 为新数据库设置默认语言环境

    --lc-collate, --lc-ctype, --lc-messages=LOCALE

    --lc-monetary, --lc-numeric, --lc-time=LOCALE

    为新的数据库簇在各自的目录中分别

    设定缺省语言环境(默认使用环境变

    量)

    --no-locale 等同于 --locale=C

    --pwfile=文件名 对于新的超级用户从文件读取口令

    -T, --text-search-config=CFG

    缺省的文本搜索配置

    -U, --username=NAME 数据库超级用户名

    -W, --pwprompt 对于新的超级用户提示输入口令

    -X, --xlogdir=XLOGDIR 当前事务日志目录的位置

    非普通使用选项:

    -d, --debug 产生大量的除错信息

    -L DIRECTORY 输入文件的位置

    -n, --noclean 出错后不清理

    -s, --show 显示内部设置

    其它选项:

    -?, --help 显示此帮助, 然后退出

    -V, --version 输出版本信息, 然后退出

    如果没有指定数据目录, 将使用环境变量 PGDATA

    2.8 配置运行环境变量(方便管理)

    [postgres@localhost contrib]$ exit

    exit

    [root@localhost contrib]# vi /etc/profile

    最后一行添加以下代码:

    export PGDATA=/data/pg/data

    export PATH=/usr/local/pgsql/bin:$PATH

    2.9 执行生效

    [root@localhost contrib]# source /etc/profile

    2.10 postgresql服务管理

    [root@localhost contrib]# su postgres

    [postgres@localhost contrib]$ pg_ctl start -D /data/pg/data

    could not change directory to "/root/download/postgresql-9.4.9/contrib": Permission denied

    server starting

    [postgres@localhost contrib]$ LOG:  database system was shut down at 2018-08-01 06:45:58 EDT

    LOG:  MultiXact member wraparound protections are now enabled

    LOG:  database system is ready to accept connections

    LOG:  autovacuum launcher started

    [postgres@localhost ~]$ ps -ef|grep postgres

    root      31261  31181  0 06:48 pts/0    00:00:00 su postgres

    postgres  31262  31261  0 06:48 pts/0    00:00:00 bash

    postgres  31277      1  0 06:48 pts/0    00:00:00 /usr/local/pgsql/bin/postgres -D /data/pg/data

    postgres  31279  31277  0 06:48 ?        00:00:00 postgres: checkpointer process 

    postgres  31280  31277  0 06:48 ?        00:00:00 postgres: writer process 

    postgres  31281  31277  0 06:48 ?        00:00:00 postgres: wal writer process 

    postgres  31282  31277  0 06:48 ?        00:00:00 postgres: autovacuum launcher process 

    postgres  31283  31277  0 06:48 ?        00:00:00 postgres: stats collector process 

    postgres  31284  31262  0 06:49 pts/0    00:00:00 ps -ef

    postgres  31285  31262  0 06:49 pts/0    00:00:00 grep --color=auto postgres

    2.11 创建database misago

    [postgres@localhost ~]$ psql -U postgres -w postgres

    psql (9.4.9)

    Type "help" for help.

    postgres=# create database misago;

    CREATE DATABASE

    3 修改配置文件( DATABASES part)

    /root/misagoforumorg/misagoforumorg/settings.py:

    DATABASES = {

        'default': {

            # Misago requires PostgreSQL to run

            'ENGINE': 'django.db.backends.postgresql',

            'NAME': 'misago',

            'USER': 'postgres',

            'PASSWORD': 'postgres',

            'HOST': 'localhost',

            'PORT': 5432,

        }

    }

    4. migrate数据库

    (my_env) [root@localhost misagoforumorg]# python manage.py migrate

    Operations to perform:

      Apply all migrations: admin, auth, contenttypes, misago_acl, misago_categories, misago_conf, misago_core, misago_legal, misago_readtracker, misago_threads, misago_users, sessions, social_django

    Running migrations:

      Applying misago_acl.0001_initial... OK

      Applying contenttypes.0001_initial... OK

      Applying auth.0001_initial... OK

      Applying misago_users.0001_initial... OK

      Applying admin.0001_initial... OK

      Applying admin.0002_logentry_remove_auto_add... OK

      Applying contenttypes.0002_remove_content_type_name... OK

      Applying auth.0002_alter_permission_name_max_length... OK

      Applying auth.0003_alter_user_email_max_length... OK

      Applying auth.0004_alter_user_username_opts... OK

      Applying auth.0005_alter_user_last_login_null... OK

      Applying auth.0006_require_contenttypes_0002... OK

      Applying auth.0007_alter_validators_add_error_messages... OK

      Applying auth.0008_alter_user_username_max_length... OK

      Applying misago_core.0001_initial... OK

      Applying misago_acl.0002_acl_version_tracker... OK

      Applying misago_acl.0003_default_roles... OK

      Applying misago_categories.0001_initial... OK

      Applying misago_threads.0001_initial... OK

      Applying misago_categories.0002_default_categories... OK

      Applying misago_categories.0003_categories_roles... OK

      Applying misago_categories.0004_category_last_thread... OK

      Applying misago_categories.0005_auto_20170303_2027... OK

      Applying misago_categories.0006_moderation_queue_roles... OK

      Applying misago_categories.0007_best_answers_roles... OK

      Applying misago_conf.0001_initial... OK

      Applying misago_core.0002_basic_settings... OK

      Applying misago_legal.0001_initial... OK

      Applying misago_threads.0002_threads_settings... OK

      Applying misago_threads.0003_attachment_types... OK

      Applying misago_threads.0004_update_settings... OK

      Applying misago_threads.0005_index_search_document... OK

      Applying misago_threads.0006_redo_partial_indexes... OK

      Applying misago_readtracker.0001_initial... OK

      Applying misago_readtracker.0002_postread... OK

      Applying misago_readtracker.0003_migrate_reads_to_posts... OK

      Applying misago_readtracker.0004_auto_20171015_2010... OK

      Applying misago_threads.0007_auto_20171008_0131... OK

      Applying misago_threads.0008_auto_20180310_2234... OK

      Applying misago_threads.0009_auto_20180326_0010... OK

      Applying misago_users.0002_users_settings... OK

      Applying misago_users.0003_bans_version_tracker... OK

      Applying misago_users.0004_default_ranks... OK

      Applying misago_users.0005_dj_19_update... OK

      Applying misago_users.0006_update_settings... OK

      Applying misago_users.0007_auto_20170219_1639... OK

      Applying misago_users.0008_ban_registration_only... OK

      Applying misago_users.0009_redo_partial_indexes... OK

      Applying misago_users.0010_user_profile_fields... OK

      Applying misago_users.0011_auto_20180331_2208... OK

      Applying sessions.0001_initial... OK

      Applying social_django.0001_initial... OK

      Applying social_django.0002_add_related_name... OK

      Applying social_django.0003_alter_email_max_length... OK

      Applying social_django.0004_auto_20160423_0400... OK

      Applying social_django.0005_auto_20160727_2333... OK

      Applying social_django.0006_partial... OK

      Applying social_django.0007_code_timestamp... OK

      Applying social_django.0008_partial_timestamp... OK

    5 create a super admin in database:

    (my_env) [root@localhost misagoforumorg]# python manage.py createsuperuser

    Enter displayed username: admin

    Enter E-mail address: ****8260@qq.com

    Enter password:q******4

    Repeat password:q******4

    Superuser #1 has been created successfully.

    6 start misago

    (my_env) [root@localhost misagoforumorg]# python manage.py runserver 192.168.58.139:8000

    Performing system checks...

    System check identified no issues (0 silenced).

    August 01, 2018 - 13:10:57

    Django version 1.11.14, using settings 'misagoforumorg.settings'

    Starting development server at http://192.168.58.139:8000/

    Quit the server with CONTROL-C.

    now from browser, you can browse the misago

    相关文章

      网友评论

          本文标题:Misago安装

          本文链接:https://www.haomeiwen.com/subject/qeyvaxtx.html