How to install OSclass in CentOS

To install Osclass in CentOS

OSclass is a free content management system as like wordpress. It is used to compose and maintain websites without any technical knowledge. Installation of OSclass is explained in this article.

Installation of Osclass requires the LAMP server. To know how to install it

visit the following link,
https://www.linuxhelp.com/install-lamp-fedora-22/


To install OSclass

Execute the following command to setup the LAMP Server.

[root@linuxhelp ~]# yum install httpd mariadb-server mariadb php php-mysql -y
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * base: mirror.nbrc.ac.in
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
updates/7/x86_64/primary_db                                                                                                                                 | 5.7 MB  00:01:30     
Resolving Dependencies
-->  Running transaction check
--->  Package httpd.x86_64 0:2.4.6-40.el7.centos.4 will be installed
-->  Processing Dependency: httpd-tools = 2.4.6-40.el7.centos.4 for package: httpd-2.4.6-40.el7.centos.4.x86_64
-->  Processing Dependency: /etc/mime.types for package: httpd-2.4.6-40.el7.centos.4.x86_64
-->  Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-40.el7.centos.4.x86_64
-->  Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-40.el7.centos.4.x86_64
.
.
.
perl-Net-Daemon.noarch 0:0.48-5.el7     
  perl-PlRPC.noarch 0:0.2020-14.el7     php-cli.x86_64 0:5.4.16-36.1.el7_2.1             php-common.x86_64 0:5.4.16-36.1.el7_2.1         php-pdo.x86_64 0:5.4.16-36.1.el7_2.1    

Dependency Updated:
  mariadb-libs.x86_64 1:5.5.47-1.el7_2                                                                                                                                             

Complete!

Start and enable the services for apache and mariadb.

[root@linuxhelp ~]# systemctl start httpd
[root@linuxhelp ~]# systemctl enable httpd
ln -s ' /usr/lib/systemd/system/httpd.service'  ' /etc/systemd/system/multi-user.target.wants/httpd.service' 
[root@linuxhelp ~]# systemctl start mariadb
[root@linuxhelp ~]# systemctl enable mariadb
ln -s ' /usr/lib/systemd/system/mariadb.service'  ' /etc/systemd/system/multi-user.target.wants/mariadb.service' 

Then set the password for the root user.

[root@linuxhelp ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we' ll need the current
password for the root user.  If you' ve just installed MariaDB, and
you haven' t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from ' localhost' .  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named ' test'  that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you' ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Now create the database and user for OSClass.

[root@linuxhelp ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with   or g.
Your MariaDB connection id is 10
Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type ' help '  or ' h'  for help. Type ' c'  to clear the current input statement.
MariaDB [(none)]>  CREATE DATABASE linuxhelp 
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>  CREATE USER ' linuxhelp' @' localhost'  IDENTIFIED BY ' linux'  
Query OK, 0 rows affected (0.06 sec)

MariaDB [(none)]>  GRANT ALL PRIVILEGES ON `linuxhelp`.* TO ' linuxhelp' @' localhost'  
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>  FLUSH PRIVILEGES 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>  exit
Bye

Use the following command to download the OSclass package.

[root@linuxhelp ~]# wget https://static.osclass.org/download/osclass.3.6.1.zip
--2016-07-20 18:33:32--  https://static.osclass.org/download/osclass.3.6.1.zip
Resolving static.osclass.org (static.osclass.org)... 54.217.201.242
Connecting to static.osclass.org (static.osclass.org)|54.217.201.242|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6575926 (6.3M) [application/zip]
Saving to: ‘ osclass.3.6.1.zip’ 

100%[=========================================================================================================================================> ] 6,575,926   94.1KB/s   in 47s    

2016-07-20 18:34:23 (136 KB/s) - ‘ osclass.3.6.1.zip’  saved [6575926/6575926]

Extracted the downloaded package into “ OSclass” directory.

[root@linuxhelp ~]# mkdir /var/www/html/osclass
[root@linuxhelp ~]# unzip osclass.3.6.1.zip -d /var/www/html/osclass
Archive:  osclass.3.6.1.zip
  inflating: /var/www/html/osclass/CHANGELOG.txt  
  inflating: /var/www/html/osclass/config-sample.php  
  inflating: /var/www/html/osclass/favicon.ico  
  inflating: /var/www/html/osclass/index.php  
  inflating: /var/www/html/osclass/licenses.txt  
   creating: /var/www/html/osclass/oc-admin/
  inflating: /var/www/html/osclass/oc-admin/admins.php  
   creating: /var/www/html/osclass/oc-admin/ajax/
  inflating: /var/www/html/osclass/oc-admin/ajax/ajax.php
.
.
.
  inflating: /var/www/html/osclass/oc-includes/phpseclib/System/SSH/Agent.php  
  inflating: /var/www/html/osclass/oc-includes/phpseclib/System/SSH_Agent.php  
  inflating: /var/www/html/osclass/oc-includes/phpseclib/openssl.cnf  
  inflating: /var/www/html/osclass/oc-includes/recaptchalib.php  
  inflating: /var/www/html/osclass/oc-load.php  
 extracting: /var/www/html/osclass/robots.txt

Set the ownership for the apache user as follows.

[root@linuxhelp ~]# chown -R apache: /var/www/html/osclass
[root@linuxhelp ~]# ls -lZd /var/www/html/osclass/
drwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/osclass/

Rename the “ config-sample.php” to “ config.php” .

[root@linuxhelp ~]# cd /var/www/html/osclass/
[root@linuxhelp osclass]# ls
CHANGELOG.txt  config-sample.php  favicon.ico  index.php  licenses.txt  oc-admin  oc-content  oc-includes  oc-load.php  robots.txt
[root@linuxhelp osclass]# mv config-sample.php config.php

Open the config.php file and add the following entries.

[root@linuxhelp osclass]# vim config.php
< ?php

/**
* The base MySQL settings of Osclass
*/
define(' MULTISITE' , 0) 

/** MySQL database name for Osclass */
define(' DB_NAME' , ' linuxhelp' ) 

/** MySQL database username */
define(' DB_USER' , ' linuxhelp' ) 

/** MySQL database password */
define(' DB_PASSWORD' , ' linux' ) 

/** MySQL hostname */
define(' DB_HOST' , ' localhost' ) 

/** Database Table prefix */
define(' DB_TABLE_PREFIX' , ' oc_' ) 

define(' REL_WEB_URL' , ' rel_here' ) 

define(' WEB_PATH' , ' http://localhost' ) 

?> 

Create apache virtual host for osclass. Open the vhosts.conf and add the following entries.

[root@linuxhelp osclass]# vim /etc/httpd/conf.d/vhosts.conf
IncludeOptional vhosts.d/*.conf

Create a directory to place the virtual host configuration file.

[root@linuxhelp osclass]# mkdir /etc/httpd/vhosts.d/
[root@linuxhelp osclass]# vim /etc/httpd/vhosts.d/osclass.conf
ServerAdmin admin@linuxhelp.com
DocumentRoot " /var/www/html/osclass/" 
ServerName linuxhelp.com
ServerAlias www.linuxhelp.com
ErrorLog " /var/log/httpd/linuxhelp.com-error_log" 
CustomLog " /var/log/httpd/linuxhelp.com-access_log"  combined

< Directory " /var/www/html/osclass/" > 
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted

Restart the apache service.

[root@linuxhelp osclass]# systemctl restart httpd

Open the browser and navigate to https://< IP_address>

Click Install

The following error occurs.

Open your terminal and install the php extensions to get rid of the above error.

[root@linuxhelp osclass]# yum install gd gd-devel php-gd -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
Package gd-2.0.35-26.el7.x86_64 already installed and latest version
Resolving Dependencies
-->  Running transaction check
--->  Package gd-devel.x86_64 0:2.0.35-26.el7 will be installed
-->  Processing Dependency: zlib-devel for package: gd-devel-2.0.35-26.el7.x86_64
-->  Processing Dependency: libpng-devel for package: gd-devel-2.0.35-26.el7.x86_64
-->  Processing Dependency: libjpeg-devel for package: gd-devel-2.0.35-26.el7.x86_64
.
.
.

libxcb.x86_64 0:1.11-4.el7 zlib.x86_64 0:1.2.7-15.el7
Complete!

Then disable the selinux.

[root@linuxhelp osclass]# vim /etc/sysconfig/selinux
SELINUX=disabled

To make the changes in SELINUX immediately, run the following command.

[root@linuxhelp osclass]# setenforce 0

And then restart the apache service.

[root@linuxhelp osclass]# systemctl restart httpd

Now open the browser and click reload.

Provide your Database Information.

Now create Admin user login for OSclass.

Enter the admin or user credentials to login.


To create a new web page, Go to Show more &rarr Pages

Click Add new

Now start creating the content for your web page and then save it.

FAQ
Q
What is the command for nofollow?
A
'nofollow' => add nofollow to the pagination links (default value: true)
Q
How to change default search keywords (ie. PHP Programmer)
A
To change it from the code we need to modify the file oc-content/themes/modern/inc.search.php:
var sQuery = '' ;
Q
What is a change of OSC search pagination menu?
A
osc_search_pagination()

This function add the default zero-configuration pagination for the search pages
Q
What is a change of OSC comment pagination menu?
A
osc_comments_pagination()

This function add the default zero-configuration pagination for the item's comments pages.
Q
What is the parameter for select?
A
'class_selected' => css class for the selected link (default 'searchPaginationSelected')