OCSNG Inventory

Let’s do an inventory!

f you’re the administrator on any network, web applications that are written in PHP, and chances are you’ve already faced the need that relies on databases. Ito make an inventory. In fact, keeping a list Several webservers, such as lighttpd or of all the computers, monitors, software and mini-httpd, can be used, but you’ll probably other component of the network up-to-date is be better off using Apache, as it’s the most always both hard and tedious. widely used webserver on the internet. That But if those lists aren’t kept up-to-date, way, you’ll have plenty of documentation it often leads to outdated machines being available if need be. There is no point to look kept around or to installing more copies of a at older versions of Apache (1.3), instead use software than the number of licenses availa- the latest one available through Debian’s re- ble. But stop worrying, as Debian can be positories (2.2), so that your installation will easily transformed into an inventory server: benefit from the latest innovations and will just follow this short installation procedure, remain usable for a long time. and then all will happen automatically. Follow As far as databases are concerned, make the guide! your life simpler and choose MySQL, which is considered to be the most user-friendly data- Preparing the installation base. Just get the latest version, version 5, The installation of the two applications, from the Debian packages repositories. OCSNG Inventory and GLPI, that are going to Lastly, OCSNG Inventory and GLPI require change your Debian in an inventory server re- two command interpreters: PHP and . quire some preparation. The two of them are Keep in mind that using PHP 5 should be favored over PHP 4, because the second is unmaintained since the end of 2007. So try to use maintai- ned and updated software whenever possible. Now, let’s get to work. There’s no manual compilation or otherwise weird installation procedures to fol- low, all you need are the standard Debian tools:

aptitude install apache2 ↵ libapache2-mod-perl2 ↵ libapache2-mod-php5 php5 ↵ php5-gd php5- php5-cgi ↵ mysql-server

Your LAMP architecture (LAMP stands for Linux-Apache-MySQL- PHP) is now deployed. If you want to do so, you can test it by going to the /var/www folder (cd /var/www). Create a file named test. (touch test.php), and edit this file, using nano for example (nano test.php). Figure 1. OCS keeps track of all the computers and servers on the network Inside, put the following:

24 LINUX IDENTITY SET www.linuxidentity.com 25 ration) is the application that’ll keep track of the computers composing your network. It is a free (as in free beer and free speech) software, and is licensed under the terms of the GPLv2. First, grab the package. Go to /var/www (cd /var/www) and use this command:

wget http://prdownloads.sour ↵ ceforge.net/ocsinventory/ ↵ OCSNG_LINUX_SERVER_ ↵ 1.01.tar.gz

Extract the content of the archive with the following command:

tar xvzf OCSNG_LINUX_SERVER_ ↵ 1.01.tar.gz cd OCSNG_LINUX_SERVER_1.01

The next step will be automatic, as an installation script is included with OCS Inventory NG. But before run- Figure 2. OCS is configured through a web-based interface ning this script, you’ll have to install some complementary packages. by the “linux” root user, or else chan- Inventory NG server to run. Once ces are that you’ll forget the MySQL again, make use of the power of Open your web browser, and type one. If you came out of this alive, aptitude: in this address: we can get into the core of the task at hand, by installing OCS Inventory aptitude install libxml- ↵ http://127.0.0.1/test.php NG. simple-perl libapache-dbi- ↵ ↵ Installing OCS perl libnet-ip-perl A page should be displayed, and it libsoap-lite-perl should be a summary of your PHP Inventory NG configuration. If that is not the case, OCS Inventory NG (Open Computer You’re now ready to run the installa- there’s something wrong, so get back and Software Inventory Next Gene- tion script: to the start and try again, making sure you’re following the steps correctly. To conclude this first part, secure your MySQL server by assigning a password for the root user. By default, when you ins- tall MySQL from the Debian repositories, the root user (the administrator of the database server) doesn’t have any kind of password. To fix that, use the following command:

mysqladmin -u root password ↵ 'your_MySQL_admin_ ↵ password' Figure 3. The GLPI interface

24 LINUX IDENTITY SET www.linuxidentity.com 25 OCSNG Inventory

sh setup.sh

You’ll be presented with a set of questions, most of them are self- explanatory, and you can select the default answers. An exception to this rule is the question “Where is Apache root document directory”, to which you should answer with the path where your web documents are loca- ted, that is /var/www. Next, as you’re told at the end of the execution of the script, restart apache:

/etc/init.d/apache2 restart

You’re not done yet with OCS Invento- ry NG, you have to proceed to the da- tabase installation. This time around, you’ll be working with a web-based Figure 4. The reservation tool of GLPI interface. So fire up your browser and point it to: because no computer has been in- libxml-sax-perl libxml-↵ ventoried yet. To change that, the OCS simple-perl po-debconf make http://127.0.0.1/ocsreports Inventory client must be installed on every computer in the network. Then download the OCS client: A page should open, and you can The OCS Inventory client fill in your MySQL configuration pa- wget http://prdownloads.sour ↵ rameters. Here is what you should It doesn’t matter if the network’s ma- ceforge.net/ocsinventory/ ↵ mention: chines are running Linux or Windows, OCSNG_LINUX_AGENT_1.01_ ↵ you have to install a client on every with_require.tar.gz MySql login : root one of them either way. Under Win- MySql password : "your_MySQL_ ↵ dows, it’s really easy: download the Extract the contents of the archive: admin_password" client at the following location: MySql HostName : 127.0.0.1 tar xvzf OCSNG_LINUX_AGENT_ ↵ http://prdownloads.sourcefor ↵ 1.01_with_require.tar.gz The OCS database then proceeds ge.net/ocsinventory/OCSNG_ ↵ cd OCSNG_LINUX_AGENT_1.01 to install itself automatically. When WIN32_AGENT_1.01_repack.zip it’s done, click on the Send button Just as you’ve done to install the ser- at the bottom of the page. And there Next, uncompress the software and ver, run the install script to compile you have it, the installation is com- run the OcsAgentSetup.exe executa- and set up the client: pleted. Connect to the web interface ble. Just type in the OCS Inventory by either clicking on the link that you server’s address and you’re done. sh setup.sh will be given, or by entering the fol- On Linux systems, it’s a little more lowing URL: complicated, as you’ll have to compi- The script will ask you a set of ques- le the software yourself. For a typical tions, and here are the answers you http://127.0.0.1/ocsreports Debian system, install the necessary should give it to end up with a typical packages: installation: Click on the flag representing your language, then login into the inter- aptitude install libcompress- ↵ Which method will you use to ↵ face by using the admin both as zlib-perl libnet-ip-perl ↵ generate the inventory? ↵ the login name and the password. libnet-ssleay-perl libwww- ↵ Http Change the admin user’s password perl libxml-simple-perl ↵ Which host is running OCS ↵ right away: click on the purple icon libssl-dev libmail- ↵ Inventory NG Communication ↵ with a key, in the upper-right corner sendmail-perl intltool- ↵ Server? The OCS server’s ↵ of the page. debian gettext libxml- ↵ address Once the password has been mo- libxml-common-perl libxml- ↵ On which port is running OCS ↵ dified, go back to the main screen. libxml-perl libxml- ↵ Inventory NG Communication ↵ As you can see, there’s nothing there namespacesupport-perl ↵ Server? 80

26 LINUX IDENTITY SET www.linuxidentity.com 27 The next steps can be carried out using a web-interface. First, you have to set some things up for GLPI to ins- tall its database automatically. Open up a web browser and go to:

http://127.0.0.1/glpi

The application is going to ask you several questions, the first being about the language you’d rather use. Then, accept the terms of the GPL license to proceed. After that, click on Install. Your setup will be tested, and there shouldn’t be any error (no lines of red text), so click on continue. You then have to input Figure 5. GLPI also provides helpdesk functionalities your MySQL parameters, as follow: What is the value of TAG? The ↵ Extract its contents: name of the computer Mysql server: 127.0.0.1 tar xvzf -0.70.tar.gz Mysql user: root If no error message gets displayed, Mysql pass: "your_MySQL_ ↵ all is well, and the client is success- A GLPI is created. This time, there’s admin_password" fully installed. In most cases, a first no need to compile anything or to run synchronization between your com- any install script. In fact, GLPI is GLPI then asks you to choose a da- puter and the server should have a web-based application, and thus by tabase, but we advise you to create been carried out. From there on, extracting the archive, you already a new one, that you’ll name “glpi”. a cron job set up by the OCS client placed the right files at the right pla- It’s simpler that way, and you won’t will update the informations from ces, the rest being done by Apache forget it or overwrite it by mistake. time to time. To make sure that and PHP who are able to interpret When you’re done, the installation this first synchronization went well, GLPI’s files. process will come to an end, and a connect to the web interface on the Nevertheless, you still have some page will open, telling you that the server, and, normally, you should see work to do: to delete the compressed installation is indeed completed. a line mentioning the name of the package and give the right permis- You can then click on Use GLPI. computer you just added. sions to the GLPI folder. You can do that by executing: Configuring GLPI Installing GLPI Connect to the application using The GLPI application (for computer rm glpi-0.70.tar.gz the login name glpi and glpi as the stock management) is often coupled chown -R www-data /var/www/glpi password. For security reasons, you to OCSNG Inventory, as it brings should change the administrator’s many interesting features to an in- Before configuring GLPI, edit a value password. Click on Settings, in ventory system. GLPI enables you in one of the configuration files of the upper part of the page. In the to manage every piece of the group PHP, /etc/php5/apache2/php.ini. Password field, type in the new pas- of computer you have to supervise, Look for the following line: sword, and use that occasion to put and lets you get an helpdesk up and an email address (the email of the running. All maintenance operations memory_limit = 16M administrator) before saving your are written in a database, and a sum- changes by clicking on Refresh. mary of the carried out actions can The value specified is too low for Next in line is the activation of the then be produced. Of course, it also GLPI to function correctly. So, replace OCS Inventory mode. Click on Confi- lets you follow the life cycle of a com- it with the following: guration / general and finally on the puter, keep tracks of the warranties, Restrictions tab. The page that’ll licenses... memory_limit = 32M show up contains a field labeled Go to the the directory where your Activate the OCSNG mode, and as web documents are placed (cd /var/ And to apply this change, just restart you might have guessed, you should www) and grab the GLPI package: Apache: set this field’s value to Yes. Save this change when you’ve done so. wget http://glpi-project.org/ ↵ /etc/init.d/apache2 restart If all is well, the configuration IMG/gz/glpi-0.70.tar.gz page for the OCSNG mode should be displayed. Now, click on the “+”

26 LINUX IDENTITY SET www.linuxidentity.com 27 OCSNG Inventory

tab, and another page should open. terface (http://127.0.0.1/glpi). Click Link with hardware when ↵ Choose Empty template and confi- on Inventory and select the kind of creating tickets: All ↵ gure the OCS server as follow: hardware you’re interested in, before hardware selecting the specific hardware you Hardware linkable to tickets:↵ Name: "choose a name" want to mark as available. select everything (keep ↵ Host: 127.0.0.1 Click on it to open its page and the [Ctrl] key pressed, and ↵ Name of OCS data base: OCSWEB click on the Click to authorize reser- click on every line) OCSweb database user: root vation button, at the bottom of the OCSweb user password: "your ↵ page. Once this profile is modified, click on root password" The reservation of an available Refresh. Then, log out of GLPI, and hardware piece happens through the log back in using an username as- Now, you can select the kind of Tools menu, in the upper menu bar. sociated to the post-only profile. The import you want to make, and you Select the Reservations submenu page that’ll open up let you request should probably choose global for to see all the available hardware. assistance (it’s called “opening a tic- each element. At the end of the line concerning ket”). The interface asks for the type That way, all is imported, but the what you’re interested in, there is a of hardware involved, and to specify hardware is managed globally (wi- calendar-shaped icon. Click on it to the priority of the request. You can thout redundant information). As far open a calendar: just click on the day also upload attachments to help as general informations on compu- for which you’d like to reserve the processing your request. It’s a really ters and on components, we advise hardware. complete tool that should cover all you to select Yes for everything to This solution is really easy to set your needs. When the request is obtain as much information as pos- up, and helps a lot when you have confirmed, you’ll be kept up-to-date sible. Last but not least, say Yes to to manage a large computer stock. with the evolution of its processing. Activate automatic link. But it implies, on the other hand, All in all, GLPI provides a simple The basic configuration of GLPI is that you’ll have to manage users with to use tool, but it should cover most now behind you, and you can, if you various permission levels. of your needs regarding daily assis- want to, fine-tune this installation to tance. adapt it to your specific needs. For GLPI helpdesk that, please refer to the online help GLPI also offers an helpdesk service: You’re on your own now... or the official website of the GLPI any user can ask the GLPI admi- With some relatively easy to perform project: http://glpi-project.org/ to nistrator for help when he faces a manipulations, you just turned your obtain additional documentation. problem on some hardware. There server into a management system again, you’ll need to manage users. for your whole network. Be it hard- How to reserve hardware Each user will have at least the ware, software, reservations, help with GLPI? post-only profile. But to make the requests or many other things, you Amidst all the functionalities offered helpdesk easier to use, you’re going know have it covered. The only thing by GLPI, there’s one that can prove to modify this profile. we can wish for is for your OCS da- particularly helpful for those who ad- Login into GLPI. In the upper tabase to contain only Debian-based ministrate large computer networks: menu bar, go to the Administration computers... the management of hardware re- menu, then to the Profiles sub-menu. servations. Indeed, you have the A list of all the available profiles will possibility to make some hardware show, in which you’ll have to select available for people on the network post-only. A new page will then be to use. displayed, with all the options regar- To make a piece of hardware ding this particular profile. Change available, connect to the GLPI web in- a few things:

28 LINUX IDENTITY SET www.linuxidentity.com 29