Showing posts with label Let's play with linux. Show all posts
Showing posts with label Let's play with linux. Show all posts

Monday, February 2, 2015

Vsftpd with SSL-TLS on CentOS 7

after installing vsftpd you have to perform
setsebool -P ftp_home_dir=1

sudo mkdir /etc/ssl/private

To create the certificate and the key in a single file, we can use this command:

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem

go to /etc/vsftpd/vsftpd.conf
comment the line
anonymous_enable=YES

uncomment the line
chroot_local_user=YES
add the line

dual_log_enable=YES
At the end add those lines
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES

ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH

save the file
firewall-cmd --permanent --add-port=21/tcp
firewall-cmd --permanent --add-port=21/udp

firewall-cmd --permanent --add-port=20/tcp
firewall-cmd --permanent --add-port=20/udp

firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload
service vsftpd restart
chkconfig vsftpd on

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
 

Tuesday, December 2, 2014

Log out from ubuntu 14.04

gnome-session-quit was not working for me

So I used

sudo pkill -u username

however sudo service lightdm restart did not work for me,got in a unresponsive blank screen



Some shell script resources

http://www.onlinevideolecture.com/computer-programming/madhur-bhatia/shell-scripting-tutorials/index.php?course_id=2898&lecture_no=58

Friday, November 21, 2014

Sunday, November 3, 2013

What is PAE Kernel

(PAE) stand for Physical Address Extension. It's a feature of x86 and x86-64 processors that allows more than 4 Gigabytes of physical memory to be used in 32-bit systems.

To enable PAE, open terminal and type the following command:

sudo apt-get install linux-headers-server linux-image-server linux-server

reboot.

Thursday, May 30, 2013

Enable EPEL Repo on CentOS 6.3



wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Monday, May 27, 2013

KVM virtualization in CentOS 6.4 part1


First disable selinux

Then give a hostname such as server1.sourav.com and an IP Address to an adapter

if this command shows some output then your processor is ready

egrep '(vmx|svm)' --color=always /proc/cpuinfo

 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*



 yum install kvm libvirt python-virtinst qemu-kvm

Then start the libvirt daemon 

 /etc/init.d/libvirtd start

it will not start unless hosts is properly configured 

like the entry 127.0.0.1   localhost 

and

10.10.*.*  server1.sourav.com  server1

should be there

To check if KVM has successfully been installed

virsh -c qemu:///system list


It should display something like this:

[root@server1 ~]# virsh -c qemu:///system list
 Id Name                 State

Now set up network bridge

yum install bridge-utils

 vi /etc/sysconfig/network-scripts/ifcfg-br0

 DEVICE="br0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=none
IPADDR=192.168.0.100
PREFIX=24
GATEWAY=192.168.0.1
DNS1=8.8.8.8
DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System br0"

Modify /etc/sysconfig/network-scripts/ifcfg-eth0 as
follows (comment out BOOTPROTO, IPADDR, PREFIX, GATEWAY, DNS1, and DNS2 and add BRIDGE=br0):

DEVICE="eth0"
#BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE="Ethernet"
UUID="73cb0b12-1f42-49b0-ad69-731e888276ff"
HWADDR=00:1E:90:F3:F0:02
#IPADDR=192.168.0.100
#PREFIX=24
#GATEWAY=192.168.0.1
#DNS1=8.8.8.8
#DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
BRIDGE=br0


Now

/etc/init.d/network restart

 yum install virt-manager libvirt qemu-system-x86 openssh-askpass


 We will create our image-based virtual machines in the directory /var/lib/libvirt/images/ which was created automatically when we installed KVM in chapter two.

To create a Debian Squeeze guest (in bridging mode) with the name vm10, 512MB of RAM, two virtual CPUs, and the disk image /var/lib/libvirt/images/vm10.img (with a size of 12GB), insert the Debian Squeeze Netinstall CD into the CD drive and run

virt-install --connect qemu:///system -n vm10 -r 512 --vcpus=2 --disk path=/var/lib/libvirt/images/vm10.img,size=12 -c /dev/cdrom --vnc --noautoconsole --os-type linux --os-variant debiansqueeze --accelerate --network=bridge:br0 --hvm



 Of course, you can also create an ISO image of the Debian Squeeze Netinstall CD (please create it in the /var/lib/libvirt/images/ directory because later on I will show how to create virtual machines through virt-manager from your Fedora desktop, and virt-manager will look for ISO images in the /var/lib/libvirt/images/ directory)...

dd if=/dev/cdrom of=/var/lib/libvirt/images/debian-6.0.5-amd64-netinst.iso

dd if=/dev/cdrom of=/var/lib/libvirt/images/debian-6.0.5-amd64-netinst.iso

... and use the ISO image in the virt-install command:

virt-install --connect qemu:///system -n vm10 -r 512 --vcpus=2 --disk path=/var/lib/libvirt/images/vm10.img,size=12 -c /var/lib/libvirt/images/debian-6.0.5-amd64-netinst.iso --vnc --noautoconsole --os-type linux --os-variant debiansqueeze --accelerate --network=bridge:br0 --hvm

The output is as follows:

[root@server1 ~]# virt-install --connect qemu:///system -n vm10 -r 512 --vcpus=2 --disk path=/var/lib/libvirt/images/vm10.img,size=12 -c /var/lib/libvirt/images/debian-6.0.5-amd64-netinst.iso --vnc --noautoconsole --os-type linux --os-variant debiansqueeze --accelerate --network=bridge:br0 --hvm


Starting install...
Allocating 'vm10.img'              |  12 GB     00:00
Creating domain...                 |    0 B     00:00
Domain installation still in progress. You can reconnect to
the console to complete the installation process.

Now go to Applications-System Tools-Virtual Machine Manager

There you will see the virtual machine running

click open

the virtual machine will start in GUI

When you start virt-manager for the first time, you will most likely see the message Unable to open a connection to the libvirt management daemon. You can ignore this because we don't want to connect to the local libvirt daemon, but to the one on our CentOS 6.4 KVM host. Click on Close and go to File > Add Connection... to connect to our CentOS 6.4 KVM host: 







Friday, April 12, 2013

Create Local/Network Repo in Scientific Linux 6.3


mount /dev/sr0 /mnt/ 

install vsftpd package, so that we can use this as a FTP server to share our repository in the client systems.

Change to the directory where you mounted Scientific Linux DVD. In our example we have mounted the DVD

DVD in /mnt directory.

    # cd /mnt/Packages
    # rpm -ivh vsftpd-2.2.2-11.el6.i686.rpm


Start the FTP Service:

    # service vsftpd start

install createrepo package if it is not installed. This is package is used to create our local 

repository.

    # rpm -ivh createrepo-0.9.8-5.el6.noarch.rpm

Oops!! It shows us the dependency problem. Let us the install missing dependencies first:

    # rpm -ivh deltarpm-3.5-0.5.20090913git.el6.i686.rpm 

Then install the another one:

    # rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm

Now install the createrepo package:

Create a folder called yumserver (You can use your own) in /var/ftp/pub directory to save 

all the packages from the Scientific Linux DVD. Copy all the files in the Packages folder from the DVD to 

/var/ftp/pub/yumserver folder:

    # mkdir /var/ftp/pub/yumserver
    # cp -ar *.* /var/ftp/pub/yumserver


it will take a while to copy all the packages in the DVD. Please be patient. After all packages are copied, create a repo file called yumserver.repo in /etc/yum.repos.d/ directory.

    # nano /etc/yum.repos.d/yumserver.repo

[localyumserver]
name="my local repository"
baseurl=file:///var/ftp/pub/yumserver
gpgcheck=0
enabled=1


Where,
[localyumserver] ==> Name of the Local Repository.
comment ==> Information about the Repository.
baseurl ==> Path of the Repository (i.e where we had copied the contents from Scientific Linux DVD)
gpgcheck ==> Authentication of the Repository, which is disabled in our case.

Now it is time to create our repository. Enter the following command in the Terminal:

    # createrepo -v /var/ftp/pub/yumserver

Now the local YUM repository creation process will begin. 

Note: Delete or rename all the other repo files except the newly created repo file i.e in our 

example it is localyumserver.repo. 
Next update the repository:

        yum clean all
        yum update

You’re done now.

Client side configuration:

Create a repo file in your client system as mentioned above in the /etc/yum.repos.d/ directory 

and remove or rename the existing repositories. Then modify the baseurl as mentioned below:

[localyumserver]
comment ="My Local Repository"
baseurl=ftp://myserver.domain.com/pub/yumserver
gpgcheck=0
enabled=1 

    (or)

[localyumserver]
comment ="My Local Repository"
baseurl=ftp://192.168.10.101/pub/yumserver
gpgcheck=0
enabled=1


source:http://ostechnix.wordpress.com/2013/01/05/setup-local-yum-server-in-centos-6-x-rhel-6-x-scientific-linux-6-x/ 

Two Important chkconfig command



chkconfig --list vsftpd

chkconfig --level 35 vsftpd on

Sunday, March 31, 2013

Learning unix basics on OpenSolaris 2009 part2




You can also use Ctrl +R to search (backward) through the history.

You can capture the output from a c ommand in a n e nv ironment variable using back-ticks:
$ TIME =`date`

$ echo $TIME

Sun Mar 31 21:56:03 IST 2013


As on most UNIX-like systems, each user on OpenSolaris has a home directory. Your home
directory path is stored in the HOME environment variable. You can also use the tilde character
(~) to navigate to your home directory or to another user’s home directory. The tilde alone
implies the current user’s home directory. The following code shows how to navigate to home
directories:

$ cd ~
$ pwd
/export/home/sourav
$ cd ~sougata
$ pwd
/export/home/sougata

This example also demonstrates that the pwd command shows your current working directory.


Wednesday, March 27, 2013

Learning unix basics on OpenSolaris 2009


If you end a command line with a backslash, bash lets you continue the command on the next
line. This feature is useful for entering lengthy commands:

$ touch \

> file1

ctrl+a to take the cursor to the beginning of the line

ctrl+e to take the cursor at the end of the line

Alt+F and Alt+B move forward 

and backward, respectively, on a word-by-word, instead of character-by-character.

from the beginning of the line Ctrl+K will cut the line and at the end of the line Ctrl+Y to 
paste are the same line as in emacs .

to get a list of all the commands in your path
that start with ‘‘fil,’’ type fil and press Tab twice:
$ file

bash first completed the word up to file (because there were no commands starting with fil
that didn’t have an e next), and then provided a list of possibilities with the second Tab.


file file-roller filesync
$ file


$ history

1ls

2ls-a

3 pwd

4 whoami

5 touch testfile

6 which gcc

7 which cc

8 rm testfile

9 history

history an integer argument to see only that number of previous commands:

$ history 2

12 date

13 history 2

To Execute a command in the history, use ! . To execute the previous com-
d, use the !! shortcut:

$ !4

whoami

test

$ date

Thu Mar 28 00:08:13 IST 2013


$ !!

date

Thu Mar 28 00:08:13 IST 2013

you can see the environment variables by the command

declare

or you can use the command

set


You can print the values of the environment variables using the echo or printf commands,
accessing the value of the variable by prefixing it with the usual $ character:

$ echo $SHELL

/bin/bash

$ printf ’’$PATH \n’’

/usr/bin

Set the value of an environment variable with an assignment statement. The following example
sets the shell history size to 1,000:

$ echo $HISTSIZE

500

$ HISTSIZE =1000

$ echo $HISTSIZE

1000

Use the which command to see which version of a command you are executing
based on your path:

$ which grep
/usr/gnu/bin/grep
$ which xterm
/usr/X11/bin/xterm
$ which which
/usr/gnu/bin/which

The user created by the installer is set up with the following path:

$ echo $PATH

/usr/gnu/bin:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin


Directory Description

/usr/bin The default directory for commands; contains utilities such as grep and
tr , a pplications such as firefox and thunderbird , shells such as
bash and zsh , and myriad other commands

/usr/ccs/bin Traditionally System V development tools, but these have mostly moved
to /usr/bin

/usr/gnu/bin The GNU versions of commands; slightly different versions of many of
them are also found in /usr/bin

/usr/sbin The system tools, commands, and daemons, such as zfs , dumpadm ,
in.routed , and others. These are generally privileged commands.

/usr/sfw/bin Traditionally the Sun Freeware (mostly GNU) tools, but almost all of
these have been moved to /usr/bin , with symlinks left here; or
symlinks have been added to /usr/bin

/usr/ucb Traditiona lly the BSD tools, but these have been moved to / usr/bin ,
with only a few symlinks left here

/usr/X11/bin X11 commands, such as xterm , xhost , and others
/usr/openwin/bin;
/usr/X/bin;
/usr/X11R6/bin
Aliases for /usr/X11/bin
/usr/xpg4/bin Ve rsions of some of the tools that adhere to the POSIX standard, where
the versions in /usr/bin don’t

/bin Alias for /usr/bin

/sbin System tools and utilities required for booting and possibly recovering
the system if /usr is not mounted. These are generally privileged
commands.


Add a location to your path

$ PATH =$PATH:/export/home/sourav/personal/data
$ echo $PATH

this folder /export/home/sourav/personal/data will be show and any executable file there can be 

invoked directly,the executable permission has to be set though


Install Vmware Tools in OpenSolaris 2009


To install vmware tools successfully

you need to copy the vmware-solaris-tools.tar.gz in a directory(for me it is /tmp/sourav)

then 

cd /tmp/sourav

gunzip -dc vmware-solaris-tools.tar.gz | tar xvf - 

or

Decompress the file using gunzip command. For example:

# gunzip vmware-solaris-tools.tar.gz


Extract the contents of the tar file with the command:

# tar xvf vmware-solaris-tools.tar 

then 

 cd vmware-tools-distrib


To install VMware Tools, run this command from the directory you changed to in step 7:

 ./vmware-install.pl


Check if VMware tools service is running with the command:

 /etc/init.d/vmware-tools status

The output is similar to:

vmtoolsd is running

Add vmware-toolbox to the list of startup commands of your desktop.



for my opensolaris(2009)

it is in 

Preference-Sessions

Click Startup Programs tab and add these entries:

/ usr/bin/vmware-user

/usr/bin/vmware-toolbox 

source:http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1023956 



Things to do after installing OpenSolaris part 1



To see the installation log

nano /var/sadm/system/logs/install_log

To update system software database

pkg refresh

pkg list -a

to install software

pkg install softwarename such as gcc

to search a software in both locally installed software and package repositories

pkg search -lr gcc

to update broken or limited repositories

pkg rebuild-index

you will find the grub confirutation file

nano /rpool/boot/grub/menu.list

Tuesday, March 26, 2013

OpenSolaris issue DNS not working solved


I manually configured Open Solaris(2009 edition),however the DNS is not working,here how it worked out for me

Nslookup resolves the name to an ip, but pinging doesn’t make it to the box…


Static IP address

Assigning a static IP address on OpenSolaris is accomplished by editing the hostname files in the directory /etc. For example, assign a static IP address to interface bge0 by editing /etc/hostname.bge0:

192.168.0.123

Set the netmask by editing the file /etc/inet/netmasks:

192.168.0.0 255.255.255.0

Set the default gateway by editing the file /etc/defaultrouter:

192.168.0.1

Note: in this solution makes sure you have fill the DNS in the GUI mode, System > Administration > Network > DNS

and make sure file /etc/resolv.conf contain the same DNS as you fill in the GUI mode

This is exactly my problems :

Successfully Resolving DNS

 nslookup http://www.yahoo.com
Server:        202.138.224.2
Address:    202.138.224.2#53

Non-authoritative answer:
http://www.yahoo.com    canonical name = http://www.wa1.b.yahoo.com.
http://www.wa1.b.yahoo.com    canonical name = www-real.wa1.b.yahoo.com.
Name:    www-real.wa1.b.yahoo.com
Address: 209.131.36.158

Pinging IP address successfully

 ping 209.131.36.158
209.131.36.158 is alive

BUT failed to ping hostname

 ping -l http://www.yahoo.com
ping: unknown host http://www.yahoo.com

So the fix is

Open your terminal and switch to root user, then edit your /etc/nsswitch.conf file and add the word “dns“ to the hosts and ipnodes lines

This is my nsswitch.conf file snippet:



passwd:     files
group:      files
hosts:      dns
ipnodes:    dns
networks:   files
protocols:  files
rpc:        files


There is default backup of /etc/nsswitch.conf file you can also just copy /etc/nsswitch.dns over it…

 cp /etc/nsswitch.dns /etc/nsswitch.conf

You may also want to check that auto-magic mode has been disabled when setting up your networking manually;

svcs -a | grep nwam

If it is enabled type;

svcadm disable svc:/network/physical:nwam

And you are done!!!


source:http://dxzstudioz.wordpress.com/2009/11/28/opensolaris-dns-resolving-problem-when-using-static-ip/

source: http://www.jansipke.nl/network-configuration-on-opensolaris/

Tuesday, March 12, 2013

Connecting Oracle 10g express using PHP and Apche on Scientific Linux 6.2


Installed Oracle 10g Express on Scientific Linux 6.2 before

http://wowmoron.blogspot.in/2012/12/install-oracle-10g-express-on.html


Ok installed PHP and Apache on Scientific Linux 6.2 before

http://wowmoron.blogspot.in/2012/11/install-apachemysqlphp-lamp-on-centos.html

Now connecting Oracle 10g express using PHP

all we have to do basically installing zend server community edition

so the steps are

create a file

/etc/yum.repos.d/zend.repo



[Zend]
name=zend-server
baseurl=http://repos.zend.com/zend-server/6.0/rpm/$basearch
enabled=1
gpgcheck=1
gpgkey=http://repos.zend.com/zend.key

[Zend_noarch]
name=zend-server - noarch
baseurl=http://repos.zend.com/zend-server/6.0/rpm/noarch
enabled=1
gpgcheck=1
gpgkey=http://repos.zend.com/zend.key

save the file and close


yum install zend-server-php-5.3



after this

nano /var/www/html/database.php


  
&lt?php

    $conn = oci_connect("hr", "your_hr_password", "127.0.0.1/XE");

    $stid = oci_parse($conn, "select last_name, salary from employees");
    oci_execute($stid);

    $nrows = oci_fetch_all($stid, $results);

    echo "&lthtml>&lthead>&lttitle>Oracle PHP Test&lt/title>&lt/head>&ltbody>";
    echo "&ltcenter>&lth2>Oracle PHP Test&lt/h2>&ltbr>";
    echo "&lttable border=1 cellspacing='0' width='50%'>\n&lttr>\n";
    echo "&lttd>&ltb>Name&lt/b>&lt/td>\n&lttd>&ltb>Salary&lt/b>&lt/td>\n&lt/tr>\n";

    for ($i = 0; $i &lt $nrows; $i++ ) {
      echo "&lttr>\n";
      echo "&lttd>" . $results["LAST_NAME"][$i] . "&lt/td>";
      echo "&lttd>$" . number_format($results["SALARY"][$i], 2). "&lt/td>";
      echo "&lt/tr>\n";
    }

    echo "&lttr>&lttd colspan='2'> Number of Rows: $nrows&lt/td>&lt/tr>&lt/table>";
    echo "&ltbr>&ltem>If you see data, then it works!&lt/em>&ltbr>&lt/center>&lt/body>&lt/html>\n";

  ?>

(ok as I can not use opening tag and closing tag in this blog I used > and < instead)

save the file and close

open your browser

localhost/database.php

you should see data and you are done