Archive

Archive for the ‘Red Hat / CentOS’ Category

Reboot linux at specific time

August 13th, 2019 No comments

Sometimes you want to reboot a server in the middle of the night. With linux it’s as simple as this command:

shutdown -r 04:00

Which will reboot the machine at 4 am in the morning. If you need to abort the reboot, use the following to abort the reboot:

shutdown -c
Categories: Bash, Linux, Red Hat / CentOS, Ubuntu Tags:

Install Citrix Receiver in Fedora 16 (x64)

May 29th, 2012 No comments

Download the Citrix Receiver client from Citrix homepage. You should be redirected there automatically when trying to access Citrix applications portal.

This was the URL in my case: http://download.citrix.com.edgesuite.net/akdlm/7044/ICAClient_12.1.0-0.x86_64.rpm?__gda__=1338288995_9d0910b8194edff271b41bda11c7737b&__dlmgda__=1338375095_b3e64146e93e0a1743df89c33919b677&fileExt=.rpm

This is another URL to get the Citrix Receiver: http://www.citrix.com/English/SS/downloads/details.asp?downloadId=2316611&productId=1689163

After the installation (download and install the rpm-package) check where your Netscape plugin folder is:

$ sudo find / -name plugins | grep -i "netscape\|firefox\|mozilla"
$ cd /usr/lib64/mozilla/plugins

Then check where your so module is:

$ sudo find / -iname *npica* -type f
$ sudo ln -s /opt/Citrix/ICAClient/npica.so npica.so

Install a missing dependency (because of 64-bits Fedora):

$ sudo yum install libasound.so.2

The first time you click on an application, your browser is likely going to popup a dialog box giving you the choice to open the file or save the file. Choose the option to open the file. Where it asks for the application to use on this type of file, type in the path to the wfica application:

/opt/Citrix/ICAClient/wfica

In my case I got error 61 because I hadn’t the certificate for “Entrust.net Secure Server Certification Auth…”. To get in I used a Win7 computer, Internet Explorer 9, menu “Tools / Internet Options / Innehåll” / Certificates-button / “Betrodda rotcertifikatutfärdare”, mark the cert you want to export, click “Export”-button, save as “DER-encoded binary x509 file (.cer)”. I then copied this file into the folder: /opt/Citrix/ICAClient/keystore/cacerts

Or you can use “OpenSSL” to convert a PEM certificate exported from Firefox in Linux:

$ sudo openssl x509 -in /home/user/Downloads/exported_cert -inform PEM \
-out /opt/Citrix/ICAClient/keystore/cacerts/my_citrix.crt -outform DER

Done!

Ref: http://www.linuxplanet.org/blogs/?cat=1997

Ref: http://www.agaveblue.org/howtos/Citrix_ICA_How-To.shtml

Ref: http://support.citrix.com/article/CTX106631

Categories: Linux, Red Hat / CentOS Tags:

Change login background in Fedora 16

March 16th, 2012 No comments
Categories: Linux, Red Hat / CentOS Tags:

Lägg upp en skrivare i CentOS/RHEL

October 19th, 2010 No comments

This will add a HP JetDirect printer:

lpadmin -p printername -v socket://ipaddress_of_printer:9100

CUPS provides two methods for adding printers: a command-line program called lpadmin(8) and a Web interface. The lpadmin command allows you to perform most printer administration tasks from the command-line and is located in /usr/sbin. The Web interface is located at:

and steps you through printer configuration. If you don’t like command-line interfaces, try the Web interface instead.

Run the lpadmin command with the -p option to add a printer to CUPS:

    /usr/sbin/lpadmin -p printer -E -v device -m ppd ENTER

For a HP DeskJet printer connected to the parallel port this would look like:

    /usr/sbin/lpadmin -p DeskJet -E -v parallel:/dev/lp1 -m deskjet.ppd ENTER

Similarly, a HP LaserJet printer using a JetDirect network interface at IP address 11.22.33.44 would be added with the command:

    /usr/sbin/lpadmin -p LaserJet -E -v socket://11.22.33.44 -m laserjet.ppd ENTER

As you can see, deskjet.ppd and laserjet.ppd are the PPD files for the HP DeskJet and HP LaserJet drivers included with CUPS. You’ll find a complete list of PPD files and the printers they will work with in Appendix C, “Printer Drivers”.

For a dot matrix printer connected to the serial port, this might look like:

    /usr/sbin/lpadmin -p DotMatrix -E -m epson9.ppd \
        -v serial:/dev/ttyS0?baud=9600+size=8+parity=none+flow=soft ENTER

Here you specify the serial port (e.g. S0,S1, d0, d1), baud rate (e.g. 9600, 19200, 38400, 115200, etc.), number of bits, parity, and flow control. If you do not need flow control, delete the “+flow=soft” portion.

The CUPS web server provides a user-friendly “wizard” interface for adding your printers. Rather than figuring out which device URI and PPD file to use, you can instead click on the appropriate listings and fill in some simple information. Enter the following URL in your web browser to begin:

Click on the Add Printer button to add a printer.

Ref: http://www.cups.org/doc-1.1/sam.html

Tips how to troubleshoot a deskjet printer in Ubuntu: http://www.experts-exchange.com/OS/Linux/Q_26926848.html?cid=1749

Categories: Linux, Red Hat / CentOS Tags:

Felsökning nätverk och WWW tjänst

October 19th, 2010 No comments
Verify it’s not a connection issue: Try to ping.
On the host when the interface is up do a ethtool eth0
If it is autoneg you should see a speed and duplex. Also the link at the bottom should say yes.
Do a tcpdump -i eth0 and make sure you can see traffic of any kind.
Then check if firewall is active with this command
service iptable status
The outpur should contain:
12   ACCEPT     tcp  —  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80
15   ACCEPT     tcp  —  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:443
(12 and 15 are the sequence numbers and could be different than the numbers listed here)
Please check both boxes for /etc/sysconfig/iptables and see if both have these:
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 443 -j ACCEPT
If not add these lines and restart firewall:
service iptables restart
Troubleshoot the Apache daemon. Check if it is working with these commands:
netstat -anpt | grep http
Do you see anything like :
tcp        0      0 :::80                       :::*                        LISTEN      3717/httpd
tcp        0      0 :::443                      :::*                        LISTEN      3717/httpd
in the output?
If not please try to restart the daemon :
service httpd restart
If this fails please check the output from :
/var/log/messages
/var/log/httpd/access_log
/var/log/httpd/error_log

Categories: Linux, Red Hat / CentOS Tags:

Starta skript vid inloggning

October 19th, 2010 No comments
This is an example how to execute a script at logon to set the Java environment. Add a script named “java.sh” to add the variable in /etc/profile.d/ (with “execute” permissions) if you’re using bash as login shell:
/etc/profile.d/java.sh
export JAVA_HOME=/usr/java/j2k1.x.x
export PATH=$PATH:$JAVA_HOME/bin
The contents of profile.d will be automatically executed with every interactive logon.
When you logoff your shell will be removed from the memory along with the entire environment. But when you logon again it will be reestablished including your new java environment.
Categories: Linux, Red Hat / CentOS Tags:

Utföra adminkommandon som användare i CentOS

October 7th, 2010 No comments

You can configuring ‘sudo’ by typing ‘visudo’ to edit the people who can use the sudo command and which commands they can run with sudo.

Some examples :

For example you could say that a user (red15) is allowed to call ‘sudo <any program>’ but he will have to identify himself with a password then :
red15 ALL=(ALL) ALL

Or you could say user (red15) is allowed to execute a program /usr/bin/ls without having to give his password:
red15 ALL=(ALL)NOPASSWD:/usr/bin/ls

Or you could say our user is allowed to run /usr/bin/ls but only as another user (not root for example):
red15 ALL=(other_user)NOPASSWD:/usr/bin/ls

Check out the offical man pages for more info about sudo.

As a side note, try running “su – “. The ” – ” option tells the computer to also load the profile and enviroment variables for the root user, which might be needed by your administration scripts.

Categories: Linux, Red Hat / CentOS Tags:

Installera trådlöst wifi i CentOS

September 28th, 2010 No comments

Install pro/wireless 3945abg on Linux Centos

Check that you have the wireless card:

# ifconfig -a

wlan0     Link encap:Ethernet  HWaddr 00:ED:3C:57:F3:DC
BROADCAST MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Then look in the following links:
http://wiki.centos.org/HowTos/Laptops/NetworkManager
http://wiki.centos.org/HowTos/Laptops/Wireless?highlight=%28wireless%29
http://wiki.centos.org/AdditionalResources/Repositories/RPMForge?action=show&redirect=Repositories%2FRPMForge

Categories: Linux, Red Hat / CentOS Tags:

Fjärrstyra en Ubuntu server via VNC

September 8th, 2010 No comments

To remote control a Linux server, you really only need SSH access.

But if you need GUI access, for security, I would either use X11 forwarding through a SSH session or set up VNC tunneled through SSH.

For X11-forwarding, you need to edit the /etc/ssh/sshd_config file to allow it and just SSH in with:

 ssh -X user@host

For tunneling VNC through SSH, the best tutorial/how-to is probably using x11vnc and ssvnc:
http://www.karlrunge.com/x11vnc/ssvnc.html#quickstart

With this setup, you don’t have a VNC server running all the time so not just anyone can connect.  When you run ssvnc (or sshvnc), it connects to the server through SSH and then starts the VNC server listening only on localhost and connects to that server.  When you log out of your SSH session, it kills the running VNC server.  All in all much more secure this way if the X11 forwarding won’t work for you.

If you’d like to run VNC all the time

Read how to use x11vnc here: http://www.karlrunge.com/x11vnc/x11vnc_opts.html

“Typical usage is:

Run this command in a shell on the remote machine “far-host”
with X session you wish to view:

 x11vnc -display :0

Then run this in another window on the machine you are sitting at:

 vncviewer far-host:0

Once x11vnc establishes connections with the X11 server and starts listening
as a VNC server it will print out a string: PORT=XXXX where XXXX is typically
5900 (the default VNC server port).  One would next run something like
this on the local machine: “vncviewer hostname:N” where “hostname” is
the name of the machine running x11vnc and N is XXXX – 5900, i.e. usually
“vncviewer hostname:0”.

By default x11vnc will not allow the screen to be shared and it will exit
as soon as the client disconnects.  See -shared and -forever to override
these protections.  See the FAQ for details how to tunnel the VNC connection
through an encrypted channel such as ssh(1).  In brief:

 ssh -t -L 5900:localhost:5900 far-host 'x11vnc -localhost -display :0'
 vncviewer -encodings 'copyrect tight zrle hextile' localhost:0

Also, use of a VNC password (-rfbauth or -passwdfile) is strongly recommended.

For additional info see: http://www.karlrunge.com/x11vnc/
and  http://www.karlrunge.com/x11vnc/faq.html

Regards, Tobias

Remote CentOS X from Windows via SSH

Run yum install vnc.

Another option is to use an X-windows with PuTTY/SSH client and configure the  X11 display to redirect for the SSH connection.

cygwin might be an option to explore ( www.cygwin.com )
What it will do is that once you establish an SSH connection from the windows 7 to the linux system with the X11 tunnel, you can then run the graphic commands on the linux and it will be redirected back through the SSH connection.
When in the SSH session on the linux, echo $DISPLAY to make sure it is set.

Categories: Linux, Red Hat / CentOS, Ubuntu Tags:

Uppgradera Red Hat

September 7th, 2010 No comments

One way is to stuck the RH5 Installation DVD in and go through the installation process but select upgrade instead of install a new system.

Another way is to use the yum groupinstall function to pick what you need:

1) first make sure you have yum-utils
# yum install yum-utils

2) check out the groups:
# yum grouplist

3) install a group:
# yum groupinstall “Web server”

4) Further, to know details of what each group means, use groupinfo, like:
#yum groupinfo “Java Development”

Categories: Linux, Red Hat / CentOS Tags: