Page 1 of 1

Seven GNUWorld Website Setup on Debian 11

Posted: Mon Feb 07, 2022 5:24 pm
by ZioN
Hello,
Bellow you can find all the steps needed to be done in order to build thr CService (X) WebPage using Debian linux server.
Please keep in mind that the IP Address of the machine used for this HOWTO is 192.168.1.133 and it should be changed with the IP address of the machine where you want to have the webpage installed.
OK, now let`s proceed....

1. First we ensure that we have everything installed :
php8.x, apache2 Server, Postgresql, Curl, composer
  • apt install build-essential
  • apt install wget git
  • apt install openssl
  • apt install libssl-dev
  • apt -y install lsb-release apt-transport-https ca-certificates
  • wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
  • echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
  • apt update
  • apt upgrade -y
  • apt-get install bison libreadline-dev zlib1g-dev automake make flex mlocate apache2 apache2-bin apache2-data apache2-dev apache2-doc apache2-ssl-dev apache2-utils libapache2-mod-php8.2 php8.2 php8.2-common php8.2-gd php8.2-pgsql php8.2-xml php8.2-cgi curl liboath-dev liboath0
locate file php.ini using the following command:
  • updatedb
  • locate php.ini
  • Open /etc/php/8.2/apache2/php.ini file and change value "short_open_tag = Off" in "short_open_tag = On"

We save the file and close.
restart the apache2 service.
  • service apache2 restart
  • service apache2 status ### Will show if apache server is running. Active: active (running) since ....

2. Now we proceed with installing composer as root:
  • curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
3. Install Postgresql 13: - Skip this step if you already have PGSQL SETUP and RUNNING.
  • apt install postgresql-server-dev-13 postgresql-client-13 postgresql postgresql-contrib

Now we start PgSQL server:
  • systemctl start postgresql


We enable PgSQL Server on reboot:
  • systemctl enable postgresql


We edit postgresql.conf and pg_hba.conf files :
  • nano /etc/postgresql/13/main/postgresql.conf

listen_addresses = '192.168.1.133'
port = 5432
Save the file and close it.

  • nano /etc/postgresql/13/main/pg_hba.conf

Add the following line:
  • Host all all 192.168.1.133/32 trust

Save and close file

Now we restart PgSQL Server:
  • systemctl restart postgresql


We create the user gnuworld in PgSQL:
  • su - postgres
  • psql
  • create user gnuworld;


We create cservice (X), ccontrol (UWorld) and local_db (WebPage):
  • CREATE DATABASE local_db with OWNER='gnuworld' ENCODING='SQL_ASCII' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' TEMPLATE=template0;


We type "\l" to see database information:
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+-----------+-------------+-------------+-----------------------
local_db | gnuworld | SQL_ASCII | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres

We exit pgsql console:

    \q

    Type exit to return to root account

      exit

      As root we create gnuworld account:
      • adduser gnuworld


      Skip Step 4.1 if you already built local_db and webpage runs on same server as X.
      4.1 We get the gnuworld(x) source code from Undernet Official GitHub under user gnuworld:
      • su - gnuworld
      • git clone https://github.com/ZioNeL/gnuworld-enhanced
      • cd gnuworld/doc
      • psql -h 192.168.1.133 -U gnuworld local_db < local_db.sql


      4.2 We get the webpage source code from Undernet Official GitHub under user gnuworld:
      • cd
      • git clone https://github.com/UndernetIRC/cservice-web
      • cd cservice-web/
      • composer install
      • cd php_includes/
      • cp config.inc.dist config.inc #edit the file with your own values
      • cp cmaster.inc.dist cmaster.inc
      #replace all containing "localhost" with IP of the currrent running PGSQL server.
      • cp blackhole.inc.dist blackhole.inc


      5. Now to create the live shortcut for the webpage:
      • cd /var/www/html/
      - if is hosted under apache root folder.
      • chmod 711 ~gnuworld
      • chmod 711 ~gnuworld/cservice-web
      • chmod 755 ~gnuworld/cservice-web/php_includes
      • chmod 644 ~gnuworld/cservice-web/php_includes/config.inc
      • chmod 755 ~gnuworld/cservice-web/docs/gnuworld/
      • ln -s /home/gnuworld/cservice-web/docs/gnuworld live




      6. There are two options to solve (IPR) restriction, bellow you can find how to on both.
      • su - gnuworld

      6.1 - Fix (IPR) by inserting your ip into Admin account direct on database cservice.
      • pico ipr.sql
      • insert into ip_restrict (id, user_id, added_by, added, type, expiry, value) values (1, 1, 1, now()::abstime::int4, 1, 0, ‘192.168.0.93’);
      ##replace " 192.168.0.93 " with the ip address shown on whois on you on irc. !!!
      • psql -h 192.168.1.133 -U gnuworld cservice < ipr.sql
      ##replace " 192.168.1.133 " with a real ip address of the machine hosting the cservice db.

      6.2 - Fix (IPR) by disableing IPR option in config.inc file
      • su - gnuworld
      • cd gnuworld
      • pico cservice_web/php_includes/config.inc
      • change define("IPR_REQUIRED",1); to define("IPR_REQUIRED",0);

      Save the file and close

      7 In order to permit login on CService Web from local IP address like 192.168.xx.xx or 10.0.0.xx the following changes must be made:

      nano /home/gnuworld/cservice-web/php_includes/config.inc
      # Replace define("DISALLOW_RESERVED_BLOCKS",1); to define("DISALLOW_RESERVED_BLOCKS",0);

      Now login using * accounts from local IP address is possible.



      This HOWTO was last updated by ZioN
      22 Aug 2023