# CentOS 7

This guide is created for new unmanaged VPS from A2hosting.com

* OS: CentOS 7
* Ram: 1GB
* Hard drive: 20 GB
* Bandwidth: 2 TB

## INITIAL SETUP

1. Login into A2 account, service to find the following info:

> * [ ] IP or hostname (if the domain name has been set up/registered)
> * [ ] Ssh username
> * [ ] SSH password
> * [ ] SSH port

2\. Connect to server using ssh. If you are on a Mac, use Terminal and type in the following command. If you are on a Window, you can use CMD (if CMD does not work, google “connecting to ssh on Window” to find the program

```bash
ssh -p xxxx yy@ zz.zz.zz.zz
```

{% hint style="info" %}
: xxxx: port number\
yy: username\
zz.zz.zz.zz: ip or hostname
{% endhint %}

&#x20;   Select “Yes” if asked to continue connecting

&#x20;   If there is a problem, follow this link:[ https://www.a2hosting.com/kb/getting-started-guide/accessing-your-account/using-ssh-secure-shell](https://www.a2hosting.com/kb/getting-started-guide/accessing-your-account/using-ssh-secure-shell)

3\. To secure your ssh and your server, set up new user and deactivate root login via SSH by following **steps 2, 3, and 5** in this tutorial:

&#x20;   <https://www.digitalocean.com/community/tutorials/initial-server-setup-with-centos-7>

&#x20;   Install sudo by:

```bash
yum –y install sudo
```

4\. Optional: Setting up time by following this link:[ https://www.tecmint.com/set-time-timezone-and-synchronize-time-using-timedatectl-command/](https://www.tecmint.com/set-time-timezone-and-synchronize-time-using-timedatectl-command/)

5\. Following this link to set up LAMP stack:

{% hint style="info" %}
In step 3, replace this part:&#x20;
{% endhint %}

![](https://3925781610-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LriQ0HJOhOOr26B9YAt%2F-LrigspgQ6jTjlzMxQpk%2F-LrihWmaJCnxwg1AMy9S%2Fimage1.png?alt=media\&token=e1441431-bfe9-48f5-bbb8-90dbc2d5a9a7)

with:

```bash
yum –y install firewalld
systemctl start firewalld
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --permanent --zone=public --add-port=7822/tcp
firewall-cmd –reload
systemctl enable firewalld
```

&#x20;In step 4: choose PHP7.2

&#x20;**Follow this tutorial from steps 1-5, make sure instruction for specific steps as indicated above**

<https://www.howtoforge.com/tutorial/centos-lamp-server-apache-mysql-php/>

6\. Install the following packages to prepare for Open enventory

```bash
yum -y install php-mysql php-gd php-mbstring php-pear zlib-devel ghostscript ImageMagick libreoffice
systemctl restart httpd
```

7\. Create a “download” folder; download OE (get the exact link from website: <https://sourceforge.net/projects/enventory/files/?source=navbar> ); unzip OE and copy to the right location:

```bash
mkdir download
cd download
wget https://sourceforge.net/projects/enventory/files/open_enventory_2018-02-21.zip
unzip open_enventory_2018-02-21.zip
cp -rp open_enventory_2018-02-21/. /var/www/html/oe
```

8\. Go to <http://xx.xx.xx.xx/oe>

{% hint style="info" %}
With xx.xx.xx.xx: is the server’s ip address
{% endhint %}

9\. The OE website should load like screenshot below

![](https://3925781610-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LriQ0HJOhOOr26B9YAt%2F-LrigspgQ6jTjlzMxQpk%2F-LriiGPkxMWjeRcSdKOJ%2Fimage2.png?alt=media\&token=1c99eb4d-bb09-440b-a76a-04f8fecbb761)

{% hint style="info" %}

* Database: choose the desired database’s name
* Username: root
* Password: use the mariadb password that was set up in step 5 of this tutorial
  {% endhint %}

10\. If successful, this page will load:

![](https://3925781610-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LriQ0HJOhOOr26B9YAt%2F-LrigspgQ6jTjlzMxQpk%2F-LriiV4FmVMzn6yqa4Vk%2Fimage3.png?alt=media\&token=e8b6463e-f4bd-4840-919d-56176f73c325)

11\. Modify .htaccess file

```bash
vi /var/www/html/oe/.htaccess
```

Modify the content of the file as in this screenshot. Important: these setting is for the server with configuration as indicated in the top of this tutorial

![](https://3925781610-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LriQ0HJOhOOr26B9YAt%2F-LrigspgQ6jTjlzMxQpk%2F-Lriia_rL4OlDtFN_RoS%2Fimage4.png?alt=media\&token=623a0267-a012-4df5-a740-7eb09894e07a)

Save the file (hit Esc, type “:wq” and then Enter) and restart httpd service

```bash
systemctl restart httpd
```

12\. Modify mysqld config:

```bash
vi /etc/my.cnf.d/server.cnf
```

Right after `[mysqld]`, add:

```bash
sql_mode = NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION 
max_allowed_packet = 64M # (or higher) 
innodb_buffer_pool_size = 1024M # to about 50% of the available memory
```

![](https://3925781610-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LriQ0HJOhOOr26B9YAt%2F-LrigspgQ6jTjlzMxQpk%2F-LriidoaW54WJn7oaf8P%2Fimage5.png?alt=media\&token=38cad0ca-1b56-4abe-8360-3eed2b052d6a)

Save the file (hit Esc, type “:wq” and then Enter) and restart httpd and mariadb services

```bash
systemctl restart httpd mariadb
```

{% hint style="success" %}
You are done with the initial set up here. Open enventory is ready to be used at this time.
{% endhint %}
