MediaTemple: Enable Imagick on your GS

Here's how to enable Imagick on your GS:

 

1. Download the latest stable from

http://pecl.php.net/package/imagick

 

2. Create folder to store the compiled module:

mkdir /home/$SITEID/data/lib
mkdir /home/$SITEID/data/lib/php/

 

 

3. Uncompress it

tar -xvzf imagick-3.1.2.tgz
cd imagick-3.1.2

 

4. Configure it with phpize (I'm using php 5.5.5 on my GS)

phpize –with-php-config=/usr/local/php-5.5.5/bin/php-config

 

5. 

 

 

 

references;

 

Hosting: Enabling Redis class on MediaTemple’s gridserver (gs)

Here's how I enabled access to a Redis server from my (GS) gridserver:

1. Store your SITEID in a variable:

export SITEID=`pwd | awk -F\/ '{ print $3 }'`

 

2. Create a folder to store the redis.so module

mkdir /home/$SITEID/data/lib
mkdir /home/$SITEID/data/lib/php/

 

3. Get the Redis PECL package (2.2.4 is the latest as of now)

wget http://pecl.php.net/get/redis-2.2.4.tgz

 

4. Uncompress it

tar -xvzf redis-2.2.4.tgz
cd redis-2.2.4

 

5. Compile it. I've set my (gs) to use PHP 5.5.5; change your accordingly

./configure --with-php-config=/usr/local/php-5.5.5/bin/php-config
make

 

6. "install" the module

cp modules/*.so /home/$SITEID/data/lib/php

 

7. Add the following to your /home/SITEID/etc/php.ini

;PECL
extension_dir=/home/97042/data/lib/php/
;redisphp
extension=redis.so

 

Check it:

Visit http://SITEID.gridserver.com/gs-bin/phpinfo.php-latest

 

redis-2-2-4-module

References

  • https://kb.mediatemple.net/questions/1682/Installing+PECL+extensions#gs
  • https://github.com/nicolasff/phpredis/issues/42
  • http://pecl.php.net/package/redis

Linode: Install mysql from package

 

# pacman -S mysql
resolving dependencies…
looking for inter-conflicts…

Targets (3): libmysqlclient-5.5.30-7  mysql-clients-5.5.30-7  mysql-5.5.30-7

Total Download Size:    12.81 MiB
Total Installed Size:   123.89 MiB

Proceed with installation? [Y/n] y
:: Retrieving packages from extra…
 libmysqlclient-5.5.30-7-x86_64        3.4 MiB   129K/s 00:27 [##################################] 100%
 mysql-clients-5.5.30-7-x86_64       834.8 KiB   115K/s 00:07 [##################################] 100%
 mysql-5.5.30-7-x86_64                 8.6 MiB   143K/s 01:02 [##################################] 100%
(3/3) checking package integrity                              [##################################] 100%
(3/3) loading package files                                   [##################################] 100%
(3/3) checking for file conflicts                             [##################################] 100%
(3/3) checking available disk space                           [##################################] 100%
(1/3) installing libmysqlclient                               [##################################] 100%
(2/3) installing mysql-clients                                [##################################] 100%
(3/3) installing mysql                                        [##################################] 100%
Installing MySQL system tables…
OK
Filling help tables…
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h li558-80 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/scripts/mysqlbug script!

[root@li558-80 ~]# systemctl start mysqld
[root@li558-80 ~]# systemctl enable mysqld
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'
[root@li558-80 ~]# mysql_secure_installation

 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 … Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 … Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 … Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 – Dropping test database…
 … Success!
 – Removing privileges on test database…
 … Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 … Success!

Cleaning up…

 

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

 

 

 

nano /etc/mysql/my.cnf
-----------------------------------------
[mysql]
default-character-set = utf8

[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
character-set-server = utf8
collation-server = utf8_unicode_ci

---------------------------------------

 

 

Linode: Update your ArchLinux VPS

connect 2 sessions on your Linode

 

On the second, run this:

dd if=/dev/urandom of=/dev/null

 

on the first one, do the following:

pacman-key --init

 

You can stop the dd process on the second connnection

pacman-key --populate archlinux

pacman-key --refresh-keys

 

Update pacman

pacman -Sy pacman

 

Update your installation

pacman -Syu

 

Enjoy a quick cofee

 

That should do it

 

 

 

 

Raspberry Pi: installing a LAMP server

Let's put the Raspberry Pi to good use:

 

1. Install Mysql

sudo pacman -S mysql

2. Start your server

# systemctl start mysqld

3. Secure your mysql installation

# /usr/bin/mysql_secure_installation

——————-

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 … Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 … Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 … Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 – Dropping test database…
 … Success!
 – Removing privileges on test database…
 … Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 … Success!

Cleaning up…

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

———————-

 

# nano /etc/mysql/my.cnf

 

[mysqld]

bind-address=127.0.0.1

 

 

Restart mysql

systemctl restart mysqld

 

 

================

Install PHP

 

pacman -S php php-apache libmcrypt libtool

 

nano /etc/php/php.ini

 

 

 

======================

 

nano /etc/locale.gen

enable:

en_US.UTF-8 UTF-8
en_US ISO-8859-1

 

save and generate your locales

# locale-gen

 

 

Install and Configure PostgreSQL

pacman -S postgresql

 

# mkdir -p /var/lib/postgres/data

# chown httpd:httpd -Rv /var/lib/postgres/

 

Configure Postgresql data dir

# su – postgres -c "initdb –locale en_US.UTF-8 -D '/var/lib/postgres/data'"

———————–

The files belonging to this database system will be owned by user "httpd".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/lib/postgres/data … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 24MB
creating configuration files … ok
creating template1 database in /var/lib/postgres/data/base/1 … ok
initializing pg_authid … ok
initializing dependencies … ok
creating system views … ok
loading system objects' descriptions … ok
creating collations … ok
creating conversions … ok
creating dictionaries … ok
setting privileges on built-in objects … ok
creating information schema … ok
loading PL/pgSQL server-side language … ok
vacuuming database template1 … ok
copying template1 to template0 … ok
copying template1 to postgres … ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and –auth-host, the next time you run initdb.

Success. You can now start the database server using:

    postgres -D /var/lib/postgres/data
or
    pg_ctl -D /var/lib/postgres/data -l logfile start
 

——————————————

 

Enable the service

# systemctl enable postgresql

Start if you want to use it before rebooting

# systemctl start postgresql

 

Hosting: Backing up your MediaTemple using rsync and a linux box

Follow these steps to setup a decent backup solution for your MT hosting (you can adapt this to any other hosting that offers SSH and RSYNC access).

First you'll want your linux box to be able to SSH into your hosting without a password using a SSH key instead.

Then, just clone the following repository somewhere in your linux box

https://github.com/PortNumber53/mt-utils

Customize the file:

mt.sh.sample

Next, make sure the variables in

0-variables.sh

match your enviroment.

Then you just need to run:

mt.sh.sample

For extra peace of mind, set it to run from a cron job.

 

 

LAMP: Installing on Slackware 13.37 64-bit

Ongoing post:

 

1. Download Apache ( http://httpd.apache.org )

tar -xvjf httpd-2.2.21.tar.bz2

cd httpd-2.2.21

I like Slackware, but I also like the Apache layout installed in Debian distributions, so:

./configure --enable-layout=Debian--enable-module=most --enable-mods-shared=most --enable-ssl=shared
make
make install


2. PostgreSQL

./configure –with-perl –with-openssl

gmake all

gmake install

 

 

PHP

./configure –with-pgsql –enable-soap –enable-zip –with-mysql=/usr/local/mysql/ –with-mcrypt –enable-mbstring –with-gd –enable-ftp –with-jpeg-dir –with-png-dir –with-bz2 –with-zlib –enable-safe-mode –with-apxs2=/usr/sbin/apxs

make

make install

 

(vps): Noexec and /tmp troubleshooting

Chrooted /tmp directory

There is also a new method that ensures that no processes currently accessing /tmp are interrupted in any way. This also ensures that your /tmp that allows execution is never accessible to currently running processes. This limits your exposure to possible exploits.

First, create a chrooted environment that contains a tmp directory that allows file execution:

root@vps01:~# mkdir -p /root/chroot /root/tmp
root@vps01:~# mount --bind / /root/chroot
root@vps01:~# mount --bind /root/tmp /root/chroot/tmp
root@vps01:~#

Next chroot into the environment you created.

root@vps01:~# chroot /root/chroot
root@vps01:/#

At this point, you are in the chrooted environment and can run any commands you need to. When you are done, simply type the command ‘exit’.

root@vps01:/# exit
exit
root@vps01:~#

Now you are back to your normal environment.

 

Linux:: SSH configuration file

To save some typing you can create aliases to the servers you frequently access via ssh. This can be accomplished by either editing the global file ( /etc/ssh/ssh_config ), if you’re root and and to make changes for all the users, or your own config file ( $HOME/.ssh/config ).

Follow the example, and remember to customize to your needs

Host *
Compression yes
Port 22
ForwardAgent yes

Host sample
HostName host.sample_of_a_very_long_host_name.com
User joe
ForwardAgent yes
Port 22
Compression yes

Now you can ssh into that server using:

ssh sample

/bin/bash: Remove Dreamweaver synchronization "stuff" from your hosting

As an online note, I’m writing this post to remind myself and help others that still suffer using Dreamweaver on a daily basis and at some point end up having a bunch of unwanted folders and files that Dreamweaver keeps for synchronization information. To remove all that from a Linux hosting (provide you have ssh access):

ssh to your server

for i in `find ./ | grep dwsync.xml`; do ls -l $i && rm $i; done
for i in `find ./ | grep '_notes'`; do ls -l $i && rmdir $i; done

inside your public html folder (the root folder would work just as well)

  • IGlr