Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Friday, August 21, 2015

How to install gcc 4.7 on Ubuntu LTS12?

Question:
I have gcc 4.6 installed on Ubuntu LTS 12.04. How can I upgrade to gcc 4.7?


NOTE!!
You also most likely need to take care of g++-4.7 as well.

So the full commands list will be:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.7 g++-4.7
 
Also, don't forget to update-alternatives, as suggested here

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7 
sudo update-alternatives --config gcc
 
This is confirmed to work in Ubuntu 12.04

Wednesday, March 18, 2015

Installing pyodbc on Ubuntu

If like me you have to begrudgingly talk to SQL Server on occasion, but you want to do so from Python on Ubuntu, you're in luck. As I'm finding is true with most things in the Python world there's a module to suit your needs.

Where SQL Server is concerned there are actually two modules available, pyodbc and pymssql, and I'm going to try both of these out to compare and contrast. In theory pymssql should be faster since it doesn't use ODBC, but pyodbc seemed as good a place as any to start.

Installation is simple enough in theory -- download the source zip and run:
python setup.py build install

On Ubuntu, however, you may run into an error or two due to missing libraries. Thankfully this is also quite easy to fix.

The specific error I ran into was:
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]

The fix is to install the unixodbc libraries as well as the python-dev libraries:
sudo apt-get install unixodbc-dev unixodbc-bin unixodbc python-dev python2.7-dev

With those installed the build and install for pyodbc works.

Next up is actually using pyodbc to talk to SQL Server, so expect a follow-up post relatively soon.

Saturday, August 3, 2013

Install Apache2.4.6 on Ubuntu LTS 12

Install Apache2 on ubuntu LTS 12

(1)Download the source codes from www.apache.org:
httpd-2.4.6-deps.tar.gz
httpd-2.4.6.tar.gz

(2)Extract the source packages and install them (APR; APR-util; Apache2).

(3)Install the PCRE (Perl Compatible Regular Expression) library.
By default, this library will be installed in the directory /usr/local/lib, but somehow Apache2 will not be able to know this. So you need to do the following:

---------------------
Ubuntu
Create a new file in /etc/ld.so.conf.d/ called .conf

Edit the file and add a line per directory of shared libraries (*.so files), it will look something like:
/usr/local/lib
Reload the list of system-wide library paths:
sudo ldconfig
---------------------
 
(3)Now you are ready to start Apache2:
#/usr/local/apache2/bin/apachectl start

You can verify that Apache2 is running:
#pgrep httpd

Or point your web browser to 127.0.0.1
It works!


Thursday, July 18, 2013

More PXE Magic

Jun 26, 2013  By Kyle Rankin

 In this article, I've decided to follow up on a topic I wrote about not in my column directly, but as a feature article called "PXE Magic" in the April 2008 issue. In that article, I talk about how to set up a PXE server from scratch, including how to install and configure DHCP and TFTP. Ultimately, I even provide a basic pxelinux configuration to get you started. Since then, PXE menus with pxelinux have become more sophisticated and graphical and could seem a bit intimidating if you are new to it. In this column, I explain how to piggyback off of the work the Debian and Ubuntu projects have done with their PXE configuration to make your own fancy PXE menu without much additional work. I know not everyone uses Debian or Ubuntu, so if you use a different distribution, hold off on the angry e-mail messages; you still can use the PXE configuration I'm showing here for your distro, provided it gives some basic examples of how to PXE boot its installer. Just use these steps as a launching off point and tweak the PXE config to work for you.

Simple Ubuntu PXE Menu

If this is your first time configuring a PXE server, for the first step, I recommend following my steps in the "PXE Magic" article to install and configure DHCP and TFTP. Otherwise, if you have existing servers in place, just make sure that DHCP is configured to point to your TFTP server (if it's on the same machine, that's fine). And, if you already have any sort of pxelinux configuration in your tftpboot directory, I recommend that you back it up and move it out of the way—I'm going to assume that your entire /var/lib/tftpboot (or /tftpboot on some systems) directory is empty to start with. For the rest of this article, I reference /var/lib/tftpboot as the location to store your PXE configuration files, so if you use /tftpboot, adjust the commands accordingly.
Both Debian and Ubuntu provide a nice all-in-one netboot configuration for each of their releases that makes it simple to PXE boot a particular release yourself. The file is called netboot.tar.gz and is located in a netboot directory along with the rest of the different install images. For instance, the netboot.tar.gz for the i386 Ubuntu 12.04 release (named Precise) can be found at http://us.archive.ubuntu.com/ubuntu/dists/precise/main/installer-i386/current/images/netboot/netboot.tar.gz.
To get started, cd to your tftpboot directory, and then use wget to pull down the netboot.tar.gz file (I'm assuming you'll need root permissions for all of these steps, so I'm putting sudo in front of all of my commands), and then extract the tarball:

$ cd /var/lib/tftpboot
$ sudo wget http://us.archive.ubuntu.com/ubuntu/dists/precise/
↪main/installer-i386/current/images/netboot/netboot.tar.gz
$ sudo tar xzf netboot.tar.gz
$ ls
netboot.tar.gz  pxelinux.0  pxelinux.cfg  
 ↪ubuntu-installer  version.info
As the ls command shows, an ubuntu-installer directory was created along with pxelinux.0 and pxelinux.cfg symlinks that point inside that ubuntu-installer directory to the real files. Without performing any additional configuration, provided your DHCP and TFTP servers were functioning, you could PXE boot a server with this configuration and get a boot menu like the one shown in Figure 1.
Figure 1. Ubuntu Precise PXE Boot Menu
Ubuntu has taken the extra steps of theming its PXE menu with its color scheme and even provided a logo. Unlike the PXE menu I demoed in my previous "PXE Magic" article, this menu functions more like a GUI program. You can use the arrow keys to navigate it, the Enter key to select a menu item and the Tab key to edit a menu entry.

Sunday, July 7, 2013

Install Samba4, LAMP, Sendmail etc in Ubuntu


Samba4 as a Domain Controller 

http://www.youtube.com/watch?v=5WKMtFyyxGI

Installing and configuring SAMBA in Ubuntu Linux 12.10 Server

http://www.youtube.com/watch?v=_ZSdaAC1ohU 

Linux Samba file sharing setup 

http://www.youtube.com/watch?v=P7lvuJdsrMY

(syncrhonize samba passwd and linux passwd with libpam-smbpass)

LAMP (Linux, Apache, MySQL, PHP) and Mail server tutorial 

http://www.youtube.com/watch?v=MrGD2X-sDQY

(a quick and easy tutorial by kevin)  

Installing and Configuring Sendmail in Ubuntu Server 12.10

http://www.youtube.com/watch?v=N_wBW9str1Y

A comprehensive tutorial from Server World 

(install NTP, SSH, Samba, DNS, DHCP, NFS, NIS, database, mail, proxy, LDAP and web server in ubuntu and CentOS) 

http://www.server-world.info/en/note?os=Ubuntu_12.04&p=install

Wednesday, May 15, 2013

install samba4 on panther

Well, installing samba in ubuntu may be easy. I was able to install samba in ubuntu LTS 12 in a minute, using apt. Everything went so smooth. But when I tried to install samba in ubuntu 10.10, which is no longer supported by now (May 2013), it turned out to be painful. Here is how I eventually made it successfully.

PART I

install samba4 on panther (ubuntu 10.10 Maverick)

1)download samba-4.0.5 source code from samba.org;

2)install some required dependencies: python-dnspython, git and a few others. (launchpad.com will help on this);

3)configure using waf as follows:
#cd path-to-samba4
#LDFLAGS="-lm -ldl -lutil" ./buildtools/bin/waf configure

#make
#make install

The default installation will be located at:
/usr/local/samba

alternatively, you may use the python way of doing it:
./install_by_python.sh


 PART II

the configure file. here is a simple example:

[global]
    workgroup = NHLBI.NIH.GOV
    server string = %h server (Samba, Ubuntu)
    map to guest = Bad User
    obey pam restrictions = Yes
    pam password change = Yes
    passwd program = /usr/bin/passwd %u
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    unix password sync = Yes
    syslog = 0
    log file = /var/log/samba/log.%m
    max log size = 1000
    dns proxy = No
    usershare allow guests = Yes
    panic action = /usr/share/samba/panic-action %d
    idmap config * : backend = tdb

[share]
    comment = this is my share 1
    path = /share
    guest ok = Yes



PART III
add the following rules to your iptables.

iptables -A INPUT -p udp -m udp --dport 137 -j ACCEPT
iptables -A NPUT -p udp -m udp --dport 138 -j ACCEPTiptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPTiptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

PART IV
Before you start your smbd daemon, you need to do two minor tasks:
(a)Make sure the ports (137,139 etc) are available. If you have other applications sunning similar services, make sure they don't conflict the ports;
(b) #touch /etc/printcap
This file does not exists by default. So you need to create one for the first time use.

 You may find the smbd binary in prefix/sbin/ directory. Run it. Then you can monitor your samba connections by:
#smbstatus
It will tell you how many clients are currently connected to your server.
Enjoy.