lunes, 3 de noviembre de 2014

install ownCloud on Ubuntu

ownCloud is one of the best file storage and private cloud opensource project available. In  a next POST I will explain the benefits. Meanwhile these are the steps to install it on Debian and Ubuntu:

1. install apache2, php and mysql

2. install these complements:
  sudo apt-get install php5-gd php-xml-parser php5-intl smbclient curl php5-curl

3. enable these 2 modules on apache:
  sudo a2enmod rewrite
  sudo a2enmod headers

4. modify the 'default' config file:
  sudo nano /etc/apache2/sites-available/default

5. inside this file look for the line : '', inside this directory definition change the line AllowOverride None for this:
  AllowOverride All

Save it

6.  restart apache:

 sudo service apache2 restart

7. download ownCloud:
   wget http://download.owncloud.org/community/owncloud-latest.tar.bz2

8. decompress it:
  tar -xjf owncloud-latest.tar.bz2

9. move the directory to 'www':
  mv owncloud /var/www

10. change the owner's directory:
  sudo chown -R www-data:www-data /var/www/owncloud/

11. let's create a database for owncloud using mysql:
  mysql -u user -p
 create database owncloud;
 grant all on owncloud.* to 'owncloud'@'localhost' identified by 'yourpaasswortdhere';

12. Cool, finally go to a web browser and type:
  localhost/owncloud

13. That's it, just add and admin user and password and you're ready

All the best


 

sábado, 1 de noviembre de 2014

Install Zend Server CE from the repos

THis quick post is about how to install Zend Server Communithy Edition on Debian Based Linux Distros.

1. sudo nano /etc/apat/sources.list and add this line:

  deb http://repos.zend.com/zend-server/deb server non-free

 save it

2. add the repo public key:
  wget  http://repos.zend.com/zend.key -O- | sudo apt-key add -
 wait some minutes until its end

3. update your repos:
  sudo apt-get update

4. Then install Zend Server:

  sudo apt-get install zend-server-ce-php-5.3

Done, now you may go through a Web Broiwser and try it at:

 localhost:10081/ZendServer or https://localhost:10082/ZendServer

Enjoy it

Downgrade a package on Debian Wheezy

Sometimes it would be necessary to use a different package version available from the official repositories of our distro, in this case I'll show how to downgrade PHP from wheezy (5.4.4) to Squeeze (5.3.x)

I've already installed php5.4.x, so the steps are:

1. sudo nano /etc/apt/sources.list, add these lines at the end:

  deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
  deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free

  deb http://security.debian.org/ squeeze/updates main contrib non-free
  deb-src http://security.debian.org/ squeeze/updates main contrib non-free

  Save your file

2.  Now, we need to display what packages we have installed and related to php5:
   PHP=$(dpkg -l | grep 5.4.4|awk '{print $2}')

  So, I put the result of the above command inside a temporal variable, I will use it later, you may change the version (5.4.4) for the one you're using, it might be later if you're using testing repo for example

3. Cool, now let's take a look to the result:
 echo $PHP
in my case I got libapache2-mod-php5 php5 php5-cli php5-common

4. Next, I will create some rule preference for apt:
   sudo nano /etc/apt/preferences.d/preferences, and I will add these lines that are related to my current installed packages displayed in the above command:

Package: php5*
Pin: release a=oldstable
Pin-Priority: 700

Package: libapache2-mod-php5
Pin: release a=oldstable
Pin-priority: 700

Package: *
Pin: release a=stable
Pin-Priority: 600

Save it

5.  update your repos:
  sudo apt-get update


6. Finally downgrade your packages:
  sudo apt-get install --reinstall $PHP

you should see a screen like this:


Notice that the packages that you displayed using dpkg ($PHP) will be downgraded


If you want you may code a php file with phpinfo() and you'll see something like this:




Regards

install linux headers on Debian Wheezy

This is a relly useful trick, many packages require the installation of linux headers, so these next steps explain the process:

0. open a terminal

1. Display your current kernel release:
  uname -r
 (put an eye on this)

2. Then use this command:
  sudo apt-get install linux-headers-$(uname -r)

 You should see a screen like this:





Just type Y and the process will start and that's all

You might get some errors, pay attention to spaces and if whether you're using repos different for your current channel as well, if you're stuck feel free to contact me

Best

lunes, 27 de octubre de 2014

login as another user in a terminal

This is an useful trick specially when we have specific users for certain services - like app servers-  the idea is to login temporally as another user in a terminal, do whatever you have to do and then logout, so, the steps are:

1. open a terminal
2. type: sudo -u myuser02 zsh
3. whoami

That's it, in this case, I use zsh as another terminal, you may use what you like.

Really useful, at least for me

Best

domingo, 26 de octubre de 2014

deploying Apache2+WebDAV on Ubuntu

WebDAV is a web authoring built into HTTP that allows to share files and work collaborative .

So, To enable it there are several steps, here they are:

1. enable the appropriated modules:
sudo a2enmod dav
sudo a2nemod dav_fs

2. restart apache:
  sudo servide apache2 restart

3. Then we need to create a directory, it would be great whether this one is outside the DocumentRoot directory, i will create it on /home:
  mkdir /home/me/webdav

4. To gain access from web we need to change the owner to www-data
   chown www-data /home/me/webdav

5. Next, we need to password protect the target directory:
  sudo htpasswd -c /etc/apache2/webdav.password me
  sudo chown root:www-data /etc/apache2/webdav.password
  sudo chmod 640 /etc/apache2/webdav.password

6. Cool, now we need to configure apache to use WebDAV, I will modify the default site configuration file:

Alias /webdav /home/me/webdav


   Order allow,deny
  Allow from all



    Options Indexes
    DAV On
    AuthType Basic
    AuthName "webdav"
    AuthUserFile /etc/apache2/webdav.password
    Require valid-user


7. At this time, we may try our advance, so from a web browser type:
    http://localhost/webdav

  You will be asked for a user and a password

 You might try it using a WebDAV client called cadaver, like this:
  cadaver http://localhost/webdav

8. for security reasons, we may disable the Directory Listing (removing the line Options Indexes) and instead, we may create an html file ( it is mandatory to named index.html), like this:



Main Page

this is the first page displayed once the directory listing is off



save it on /home/me/webdav, restart apache and try to access it

Next, I will write about how to use it in a production environment.

Best

sábado, 25 de octubre de 2014

executing commands using sudo without ask for password

Sometimes is annoying write the root password for execute certain commands, specially if you are working on console mode, that's why is really great to custom sudo ( using visudo) in order to avoid the password prompt:

1. open your terminal
2. type sudo visudo
3. then add these lines:

User_Alias MANAGERS = user1, user2

Cmnd_Alias SHUTDOWN = /sbin/reboot, /sbin/halt

4. Then add this line at the end of the file:
MANAGERS ALL = (ALL) NOPASSWD: SHUTDOWN

that's it, save it and try it

At least for me it works putting the NOPASSWD line at the end, I'm not sure if the way SUDO reads this file is from bottom to top, anyway, try it

Best