Showing posts with label Slackware. Show all posts
Showing posts with label Slackware. Show all posts

Thursday, February 26, 2015

install and configure Xymon to monitor Slackware part 2

cd /home/xymon/server/etc
nano bb-hosts
write

192.168.28.160  xpvirtual.sourav.com  #XP
save and exit
su xymon
/home/xymon/server/hobbit.sh stop
/home/xymon/server/hobbit.sh start
go to
192.168.28.51/xymon
and you should see the xpvirtual.sourav.com entry
install bbwin on windows xp client
select full features to be installed
run regedit
hkey local machine-software-BBWin
on the right side pane
right click on hostname and click modify
paste xpvirtual.sourav.com under value data
open
c:\Program Files\BBWin\etc\BBWin.cfg in notepad
make the first line look like this

where 192.168.28.51 is the ip of the xymon server

go to services.msc
start the Big brother xymon client and make the service automatic at startup if it is manual
Now on windows xp run-firewall.cpl
advanced ,local area connection ,settings
on the icmp tab
click on the allow incoming echo request
Now on the xymon server

/home/xymon/server/hobbit.sh stop
/home/xymon/server/hobbit.sh start
Now go to
go to
192.168.28.51/xymon
you should see more information about xpvirtual.sourav.com
Now on the xymon server
cd /home/xymon/server/etc

make the end look like this
page linux Linux
group-compress (less than sign)font size="+1"("greater than sign")Linux("less than sign")/font"("greater than sign")
192.168.28.51   slackwarepc      # bbd http://slackwarepc/
page workstation Workstation
group-compress (<)font size="+1"(>)Workstation(<)/font(>)
10.10.29.141    MyPC             #Win8
192.168.28.160  xpvirtual.sourav.com  #XP

save and exit
/home/xymon/server/hobbit.sh stop
/home/xymon/server/hobbit.sh start
go to
192.168.28.51/xymon
you should see the two divisions named Linux and Workstaions

Sourav Bhattacharya
(Slackware Lover)



 

Monday, February 16, 2015

Install and configure Xymon to monitor Slackware part 1

download rrdtool and fping and xymon package in tar.gz format

tar -zxvf fping ...

cd fping ..

./configure

make

make install


tar -zxvf rrdtool...

cd rrdtool

./configure

make

make install

tar -zxvf xymon-...

cd xymon ..

groupadd xymon

useradd xymon -g xymon

./configure.server

keep saying y to the questions(press enter)

when asked which group does the webserver use

the answer should be apache

the ip address of the machine should not be 127.0.0.1

it should be

192.168.28.51

and keep saying yes and you are done


make

make install

type

visudo

or

mcedit /etc/sudoers

under the section

Cmnd alias specification

Write Cmnd_Alias and press tab

Cmnd_Alias    XYM = /usr/local/sbin/fping *

then go to user privilege specification

go to under the line as

root    All=(ALL)  All

type

xymon    All = NOPASSWD: XYM


save and exit

su xymon

and try to run

/usr/local/sbin/fping google.com

and I have faced this error

Fping can only be run by root

So I tried

as root

chown root:xymon /usr/local/sbin/fping

chmod 710 /usr/local/sbin/fping

chmod ug+s /usr/local/sbin/fping

and then

become xymon

su xymon

and then

/usr/local/sbin/fping google.com

the thing is working now

become root

mc

go to /home/xymon/server/etc

see if hobbitserver.cfg exists

go to /etc/httpd/httpd.conf

Under the line

Include /etc/httpd/mod_php.conf

Write

Include /home/xymon/server/etc/hobbit-apache.conf

save and exit

/etc/rc.d/rc.httpd restart

su xymon

/home/xymon/server.hobbit.sh start

ps aux | grep hobbit


Now from a client pc

if I type

http://192.168.28.51/xymon

it shows 404 Not Found URL/xymon was not found on this server

So I went to

cd /home/xymon/server/etc

nano hobbit-apache.conf

find this line

Alias /xymon/  "/home/xymon/server/www/"

and change it to

Alias /xymon  "/home/xymon/server/www"

save and exit

/etc/rc.d/rc.httpd restart

and

open from client pc

192.168.28.51/xymon

it is working now

go to

cd /home/xymon/server/etc

nano bb-hosts

add this line at the last

10.10.29.141    MyPC             #Win8


save and exit

su xymon

/home/xymon/server/hobbit.sh stop

/home/xymon/server/hobbit.sh start

now you will find 2 host on the main view of xymon

at 192.168.28.51/xymon


      

Install and configure MySQL on Slackware

type mc

go to /etc/

copy my-large.cnf to my.cnf by pressing ctrl+F5

make the destination to /etc/my.cnf

press alt+o to save on the last opened window

press ctrl+F10 to exit from mc

type mysql_install_db

chown -R mysql:mysql /var/lib/MySQL

/etc/rc.d/rc.mysqld stop

/etc/rc.d/rc.mydsqld start

ps aux | grep mysql | grep -v grep

mysql should be listed

set root password

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';

Wednesday, December 24, 2014

Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName solved on Slackware


Just go to /etc/httpd/httpd.conf file

ServerName slackwarepc.sourav.com:80

Apache,PHP and SSL configuration on Slackware 12.2

apache,php and ssl configuration on slackware

login as root

pkgtool

select setup

click services

select rc.httpd

put a star beside it

exit

mcedit /etc/httpd/httpd.conf

find the line

DirectoryIndex index.html

copy the line and paste it just below the line

DirectoryIndex index.html

change html to php

find mod_php

you will find the line

Include /etc/httpd/mod_php.conf

uncomment this line

save and exit

mcedit /etc/httpd/php.ini

find the line

short_open_tag=Off

change it to On

find another line

asp_tags=Off

change it to On

save and exit

cd /var/www/htdocs

mc

the mc interface will open

copy the index.html file
rename the copied file as index.php

open the index.php file in mc

write

less than?php

phpinfo();
?greater than

save and exit

/etc/rc.d/rc.httpd stop

/etc/rc.d/rc.httpd start

go to http://192.168.28.51/index.php

you should see the php information

to get the information about httpd

slackpkg info httpd

cd /etc/rc.d

ls

you will find rc.httpd

if rc.httpd is not executable

make it executable

chmod +x rc.httpd

mcedit /etc/httpd/httpd.conf

find the line 

Listen 80

change it to

192.168.28.51:80

find the line

starting with 

Loadmodule ssl

uncomment this line

find the file

Include /etc/httpd/extra/httpd-ssl.conf

uncomment this line

save and exit

open

/etc/httpd/extra/httpd-ssl.conf

find the line 

Listen 443

change it to

192.168.28.51:443

(if you keep the Listen 443 line ,you will get an error starting apache,so remove Listen 443)

find

SSLCertificateFile "/etc/httpd/server.crt"

uncomment the line if it is commented

find

SSLCertificateKeyFile "/etc/httpd/server.key"

uncomment the line if it is commented

save and exit

Now 

locate *.crt

you will find a crt file in the /usr/doc/openvpn 2.x/sample-keys folder

go to that folder

copy server.crt and server.key file to /etc/httpd/


/etc/rc.d/rc.httpd restart

netstat -ntlp | grep httpd

it will show httpd listening on 80 and 443 port

open

https://192.168.28.51






Thursday, December 4, 2014

Configure samba on slackware 12.2

1 - Change directory to /etc/samba.
rootatslackwarepc:/etc/samba# cd /etc/samba
 

2 - Copy /etc/samba/smb.conf-sample to /etc/samba/smb.conf.

 rootatslackwarepc:/etc/samba# cp smb.conf-sample smb.conf
 

3 - Edit smb.conf configuration file.
rootatslackwarepc:/etc/samba# vim smb.conf
 

Here is how I set samba server for file sharing in my network for your reference:
#======================= Global Settings =====================================
 [global]

 # workgroup = NT-Domain-Name or Workgroup-Name, eg: LINUX2
 workgroup = MYGROUP

 # server string is the equivalent of the NT Description field
server string = Samba Server

 # Security mode. Defines in which mode Samba will operate. Possible
 # values are share, user, server, domain and ads. Most people will want
 # user level security. See the Samba-HOWTO-Collection for details.
security = user

 # This option is important for security. It allows you to restrict
 # connections to machines which are on your local network. The
 # following example restricts access to two C class networks and
 # the "loopback" interface. For more examples of the syntax see
 # the smb.conf man page
 ; hosts allow = 192.168.1. 192.168.2. 127.
hosts allow = 192.168.1. 127.

 # this tells Samba to use a separate log file for each machine
 # that connects
log file = /var/log/samba.%m

 # Put a capping on the size of the log files (in Kb).
max log size = 50

 # DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
 # via DNS nslookups. The default is NO.
dns proxy = no

 #============================ Share Definitions ==============================
[homes]
 comment = Home Directories
 browseable = no
 writable = yes

 # This one is useful for people to share files
[tmp]
 comment = Temporary file space
 path = /tmp
 read only = no
 public = yes

 # A publicly accessible directory, but read only, except for people in
 # the "sales" group
[sales]
 comment = Public Stuff
 path = /home/samba
 public = yes
 writable = yes
 printable = no
 write list = atsales
 

That is a basic file sharing configuration. I didn't add anything. Just uncomment configuration I need for my network, and set shared directory path and name. I also didn't allow printer sharing in this configuration.
Now we need to test smb.conf for any error although we didn't do much editing in the file. The command for checking smb.cof configuration file is testparm. Here is the result of the above configuration:
rootatslackwarepc:/etc/samba# testparm
 Load smb config files from /etc/samba/smb.conf
 Processing section "[homes]"
 Processing section "[tmp]"
 Processing section "[sales]"
 Loaded services file OK.
 Server role: ROLE_STANDALONE
 Press enter to see a dump of your service definitions

 [global]
 workgroup = MYGROUP
 server string = Samba Server
 log file = /var/log/samba.%m
 max log size = 50
 dns proxy = No
 wins support = Yes
 hosts allow = 192.168.1., 127.

 [homes]
 comment = Home Directories
 read only = No
 browseable = No

 [tmp]
 comment = Temporary file space
 path = /tmp
 read only = No
 guest ok = Yes

 [sales]
 path = /usr/local/samba/public
 read only = No
 guest only = Yes
 guest ok = Yes
 rootatslackwarepc:/etc/samba#
 

Create samba users, groups, shared directory and set permissions.
Samba users are independent from Linux system users and groups. That means they are not sharing the /etc/passwd users. So you need to create samba users again and give them password. Here is how to do it:
rootatslackwarepc:~# smbpasswd -a labu
 New SMB password:
 Retype new SMB password:
 Failed to modify password entry for user labu
 

Why do I failed to create user for samba? That's because samba user must first be a Linux system user. So create an account for a samba user in Linux system first then create a samba account:
rootatslackware:~# smbpasswd -a labu
 New SMB password:
 Retype new SMB password:
 Added user labu.
 rootatslackware:~#
 

When you successfully created a samba user account, the database about user account and password is kept in /etc/samba/private/smbpasswd file. This is only applicable for Slackware Linux. Other distribution could be different.
If you want to give permission only for a certain people, you can create a group for them to use a certain directory. Create that certain directory. Then, you can set permissions and ownership for that group to use the directory. Here is a step by step on how to do it:
Add group, create a directory and change group owner and permission for that group:
rootatslackwarepc:~# groupadd sales
 rootatslackwarepc:~# mkdir /home/sales
 rootatslackwarepc:~# ls -l /home | grep sales
 drwxr-xr-x 2 root root 4096 2008-11-29 23:23 sales/
 rootatslackwarepc:~# chown sales.sales /home/sales
 rootatslackwarepc:~# ls -l /home | grep sales
 drwxr-xr-x 2 root sales 4096 2008-11-29 23:23 sales/
 rootatslackwarepc:~# chmod 775 /home/sales/
 rootatslackwarepc:~# ls -l /home | grep sales
 drwxrwxr-x 2 root sales 4096 2008-11-29 23:23 sales/
 

Now we need to add users to the sales group. Here is how to do it:
rootatslackwarepc:~# usermod -g users -G sales labu
 

We can check whether user labu has been added to the sales group in /etc/group:
rootatslackwarepc:~# cat /etc/group
 

Make sure user you added is in the group, like this:
sales:x:102:labu
 

Start Linux samba service
If everything is ready, then it's time to start Linux samba service. The samba server is a standalone server, so you have to make it executable before start the service. Here is all the steps that you should do to restart Linux samba service:
Set 755 permissions for samba service:
rootatslackwarepc:~# chmod 755 /etc/rc.d/rc.samba
 rootatslackwarepc:~# ls -l /etc/rc.d/rc.samba
 -rwxr-xr-x 1 root root 791 2008-03-16 04:52 /etc/rc.d/rc.samba*
 rootatslackwarepc:~#
 

Now we can restart the service:
rootatslackwarepc:~# /etc/rc.d/rc.samba restart
 Starting Samba: /usr/sbin/smbd -D
 /usr/sbin/nmbd -D
 rootatslackwarepc:~#
 

Testing and troubleshooting Linux samba server and client
We can query using nmblookup host:
rootatslackwarepc:~# nmblookup slackwarepc
 querying slackwarepc on 192.168.1.255
 192.168.1.3 slackwarepc
 rootatslackwarepc:~#
 

Test using smbclient:
luzaratslackwarepc:~$ smbclient -L 192.168.1.3
 Password:
 Domain=[slackwarepc] OS=[Unix] Server=[Samba 3.0.33]

 Sharename Type Comment
 --------- ---- -------
 netlogon Disk Network Logon Service
 tmp Disk Temporary file space
 public Disk
 IPC$ IPC IPC Service (Samba Server)
 luzar Disk Home Directories
 Domain=[slackwarepc] OS=[Unix] Server=[Samba 3.0.33]

 Server Comment
 --------- -------


 Workgroup Master
 --------- -------
 MYGROUP slackwarepc
 luzaratslackwarepc:~$



source:http://www.basicconfig.com/linux_samba_server_setup
 

Wednesday, December 3, 2014

Configure Bind on Slackware 12.2

The dns master configuration file is named.conf. Its location is /etc/named.conf. We better backup this file first for safety reason if we screw up later.

root@slackware:/etc# cp named.conf named.conf.bac
 root@slackware:/etc# ls -l | grep named.conf
 -rw-r--r-- 1 root root 681 2008-04-14 06:07 named.conf
 -rw-r--r-- 1 root root 681 2008-12-01 01:13 named.conf.bak
 root@slackware:/etc#


Let's view the named.conf file with less command: 

options {
 directory "/var/named";
 /*
 * If there is a firewall between you and nameservers you want
 * to talk to, you might need to uncomment the query-source
 * directive below. Previous versions of BIND always asked
 * questions using port 53, but BIND 8.1 uses an unprivileged
 * port by default.
 */
 // query-source address * port 53;

 /*
 * ISP dns server ip address
 */
 forward first;
 forwarders {
 200.188.1.123;
 200.188.1.124;
 };

 };

 //
 // a caching only nameserver config
 //
 zone "." IN {
 type hint;
 file "caching-example/named.root";
 };

 zone "localhost" IN {
 type master;
 file "caching-example/localhost.zone";
 allow-update { none; };
 };

 zone "0.0.127.in-addr.arpa" IN {
 type master;
 file "caching-example/named.local";
 allow-update { none; };
 };


This is the default named.conf configuration. By default, named.conf file only configured for localhost. So we need to edit or add our domain in this file later. We also need to create new dns zone files for our domain. We can see that all dns zone files were kept in /var/named/caching-example directory. So let's view /var/named/caching-example directory: 

root@slackware:/etc# ls -l /var/named/caching-example/
 total 16
 -rw-r--r-- 1 root root 195 2008-09-17 15:26 localhost.zone
 -rw-r--r-- 1 root root 2878 2008-09-17 15:26 named.ca
 -rw-r--r-- 1 root root 433 2008-09-17 15:26 named.local
 -rw-r--r-- 1 root root 2878 2008-09-17 15:26 named.root
 root@slackware:/etc#


Setup additional dns zones

You know that to setup dns you need a qualified domain name? That's true but not totally true. You can setup local BIND caching name server for your local network to speed up dns lookups, which in turn will speed up all of your Internet services. Here are examples of default configuration zone files for bind dns server:

This is localhost.zone file default configuration. It is configured for localhost:

$TTL 86400
 $ORIGIN localhost.
 @ 1D IN SOA @ root (
 42 ; serial (d. adams)
 3H ; refresh
 15M ; retry
 1W ; expiry
 1D ) ; minimum

 1D IN NS @
 1D IN A 127.0.0.1


This is named.local file default configuration. As you can see in the /etc/named.conf file configuration above, this is the reverse dns configuration file, also configured for localhost:

$TTL 86400
 @ IN SOA localhost. root.localhost. (
 1997022700 ; Serial
 28800 ; Refresh
 14400 ; Retry
 3600000 ; Expire
 86400 ) ; Minimum
 IN NS localhost.

 1 IN PTR localhost.


When we added our new domain, we'll just need to copy and configure these two files to setup bind dns server, for private dns or public dns. We leave alone the cache zone file, named.ca and the master list of the root name servers, named.root. Well, the named.root should be update from time to time though. Normally once a month because it does not change very often. Get latest update named.root from ftp.internic.net.

These are normal terms or jargon that we should know to understand bind configuration files:
•$TTL - sets a default time-to-live. 
•w - For week
•d - For day
•h - For hour
•m - For minute
•s - For second
•@ - same as $ORIGIN.
•IN - Defines the address class; IN = Internet.
•SOA - Start of Authority - Indicates authority for this zone.
•Serial number - Serial number in YYYYMMDDSS, where SS is number the file changed.
•Refresh - Tells dns slave, or secondary servers how often to check for updates.
•Retry - Tells the secondary server how often it should resend the request if fails.
•Expire - Period of time the secondary server can use its existing data.
•Minimum, or Negative-caching TTL - Cached on non-authoritative servers.
•A - Alias record - Name-to-address mapping.
•PTR - Address-to-name mapping.
•CNAME - (canonical name) alias to an A record.
•NS - Lists a nameserver for this zone.

Setup local caching name server(cache dns)

In Slackware, we don't have to edit anything to setup local caching name server. As you can see above, the localhost already configured! What we have to do is just enable bind daemon and run the service. Let's see if what I say is true.

Start dns service

Bind uses standalone server which means it's not included in inetd master server. So we have to make it executable to start the service. Here are the steps you need to do:

Change bind daemon's permission and make it executable. Here is an example:

root@slackware:~# ls -l /etc/rc.d/rc.bind
 -rw-r--r-- 1 root root 3116 2008-04-14 05:48 /etc/rc.d/rc.bind
 root@slackware:~# chmod 755 /etc/rc.d/rc.bind
 root@slackware:~# ls -l /etc/rc.d/rc.bind
 -rwxr-xr-x 1 root root 3116 2008-04-14 05:48 /etc/rc.d/rc.bind*
 root@slackware:~#


Now we can start the service. Here is an example command to start bind service(dns service) in Slackware:

root@slackware:~# /etc/rc.d/rc.bind start
 Starting BIND: /usr/sbin/named
 root@slackware:~#


The bind service has been started and it should be running now. But how do we now that our local caching name server is running ok?

Testing and troubleshooting dns server

To check named.conf configuration file, we can use named-checkconf tool:

root@slackware:~# named-checkconf /etc/named.conf


To check zone configuration file, we can use named-checkzone tool:

root@slackware:~# named-checkzone localhost /var/named/caching-example/localhost.zone


Use dig command to query reverse lookup.

root@slackware:~# dig -x 127.0.0.1 
; > DiG 9.4.2-P2 > -x 127.0.0.1
 ;; global options: printcmd
 ;; Got answer:
 ;; ->>HEADER ;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
 ;; WARNING: recursion requested but not available

 ;; QUESTION SECTION:
 ;1.0.0.127.in-addr.arpa. IN PTR

 ;; ANSWER SECTION:
 1.0.0.127.in-addr.arpa. 10000 IN PTR localhost.

 ;; Query time: 7 msec
 ;; SERVER: 192.168.1.1#53(192.168.1.1)
 ;; WHEN: Mon Dec 1 22:59:54 2008
 ;; MSG SIZE rcvd: 63



Run dig hostname command to query server response.

root@slackware:~# dig localhost

 ; > DiG 9.4.2-P2 > localhost
 ;; global options: printcmd
 ;; Got answer:
 ;; ->>HEADER ;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
 ;; WARNING: recursion requested but not available

 ;; QUESTION SECTION:
 ;localhost. IN A

 ;; ANSWER SECTION:
 localhost. 10000 IN A 127.0.0.1

 ;; Query time: 3 msec
 ;; SERVER: 192.168.1.1#53(192.168.1.1)
 ;; WHEN: Mon Dec 1 23:01:09 2008
 ;; MSG SIZE rcvd: 43

 root@slackware:~#


We got response there, didn't we? At the answer section there we got localhost respond to our query.

Setup a private bind dns server

To setup a private bind dns server, we need to add a new zone in the /etc/named.conf file and configure a new zone in /var/named/caching-example. This is an example of a new zone and it's reversed name resolution zone that you can add in /etc/named.conf for private dns server:

zone "example.com" in {
 allow-transfer { any; };
 file "caching-example/zone.example.com";
 type master;
 };

 // Set up reversed name resolution
 zone "1.168.192.in-addr.arpa" {
 type master;
 file "caching-example/192.zone";
 };


Make a copy of localhost.zone file and named it zone.example.com (name it zone.yourdomain.com). Below is my zone.example.com configuration. You can edit this file, add other servers you have in your network and just change names and ip addresses to your own.

;
 ; Data for private bind dns server
 ;
 $TTL 1D
 @ 1D IN SOA slackware.example.com. root.example.com. (
 2008120101 ; serial
 3H ; refresh
 15M ; retry
 1W ; expiry
 1D ) ; minimum

 ;

 @ IN NS slackware.example.com.
 @ IN A 192.168.1.3
 slackware IN A 192.168.1.3
 web IN CNAME slackware.example.com.


This is the reversed name resolution zone configuration:

;
 ; Reverse lookup dns zone file for private bind dns server
 ;
 $TTL 1D
 @ IN SOA slackware.example.com. root.example.com. (
 2008112302 ; Serial
 604800 ; Refresh
 86400 ; Retry
 2419200 ; Expire
 86400 ) ; Negative Cache TTL

 @ IN NS slackware.
 3 IN CNAME slackware.example.com.


You need to restart the bind service before your new dns takes effect. Before you restart the service, make sure you check /etc/named.conf and zone files syntax as mentioned in the testing dns section above. If you encounter problems, you can always check log file in /var/log/messages.

Setting up a private and a public dns server is the same except for a public bind dns server you need a qualified domain name and ip address.


Source:http://www.basicconfig.com/slackware_linux_dns_server_setup