Instalacja Apache 2.4 + PHP 5.4 + MySQL 5.5 + phpMyAdmin 3.5 na Linux Slackware 14 [Krok po kroku]

#####INSTALACJA MYSQL 5.5.29######

W pierwszej kolejności pobieramy mysql ze strony projektu. Ja posłużę się wersją 5.5.29.

#su -        
#cd /usr/src
#wget http://mirror.yandex.ru/mirrors/ftp.mysql.com/Downloads/MySQL-5.5/mysql-5.5.29.tar.gz
LOG:
Saving to: 'mysql-5.5.29.tar.gz'
50% [==================>                    ] 12,657,669   233KB/s  eta 32s
 84% [================================>      ] 21,108,373   321KB/s  eta 10s
 100%[======================================>] 24,870,769   248KB/s   in 68s
2013-01-15 16:22:30 (355 KB/s) - 'mysql-5.5.29.tar.gz' saved [24870769/24870769]
 

Rozpakowujemy archiwum

# tar zxvf mysql-5.5.29.tar.gz
LOG:
mysql-5.5.29/
 mysql-5.5.29/Docs/
 mysql-5.5.29/Docs/glibc-2.2.5.patch
 mysql-5.5.29/Docs/mysql.info
 .
 .
 .
 mysql-5.5.29/mysql-test/lib/My/Handles.pm
 mysql-5.5.29/mysql-test/lib/My/Config.pm
 mysql-5.5.29/mysql-test/lib/My/CoreDump.pm
 mysql-5.5.29/mysql-test/lib/mtr_io.pl
 mysql-5.5.29/mysql-test/lib/mtr_misc.pl
 mysql-5.5.29/mysql-test/lib/mtr_gcov.pl
# cd mysql-5.5.29  
 # cmake . -LH
LOG:
 
-- Looking for sigwait - found
 -- Looking for sigaddset
 -- Looking for sigaddset - found
 -- Looking for sigemptyset
 -- Looking for sigemptyset - found
 -- Looking for sighold
 -- Looking for sighold - found
 -- Looking for sigset
 -- Looking for sigset - found
 -- Looking for sleep
 -- Looking for sleep - found
 -- Looking for snprintf
 -- Looking for snprintf - found
 -- Looking for stpcpy
 .
 .
 .

Kompilujemy MySQL

#cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/   -DMYSQL_DATADIR=/usr/local/mysql/database/   -DWITH_ARCHIVE_STORAGE_ENGINE=1   -DWITH_FEDERATED_STORAGE_ENGINE=1   -DWITH_BLACKHOLE_STORAGE_ENGINE=1   -DINSTALL_LAYOUT=STANDALONE   -DENABLED_PROFILING=ON   -DMYSQL_MAINTAINER_MODE=OFF   -DWITH_DEBUG=OFF    -DWITH_SSL=yes
# make
LOG
 
Scanning dependencies of target my_safe_process
 [100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o
 Linking CXX executable my_safe_process
 [100%] Built target my_safe_process
# make install

MySQL został zainstalowany, teraz konfiguracja.

# cd /usr/local/mysql/
# mkdir database
 # chown -R mysql:mysql database/
 # chown -R mysql:mysql .
 # scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/database
#egrep -v '^#|^ *$' support-files/my-medium.cnf > /etc/my.cnf

W pliku konfiguracyjnym /etc/my.cnf należy zahashować dwie pozycje

myisam_sort_buffer_size = 8M
#log-bin=mysql-bin
#binlog_format=mixed
server-id       = 1

# bin/mysqld_safe --user=mysql --datadir=/usr/local/mysql/database/ --pid-file=/usr/local/mysql/database/mysql.pid &
# bin/mysql_secure_installation
LOG
Enter current password for root (enter for none): enter
 Set root password? [Y/n] y    /ustaw hasło root'a/
 Remove anonymous users?* [Y/n] y
 Disallow root login remotely? [Y/n] y
 Remove test database and access to it? [Y/n] y
 Reload privilege tables now? [Y/n] Y

*-y/n (y -blokowanie z poza localhost / n - dostęp zdalny)

 

Tworzymy plik startowy i kopiujemy

# vi /etc/init.d/rc.mysqld

#!/bin/sh
#
# /etc/rc.d/rc.mysqld
#

#!/bin/sh
BASEDIR=”/usr/local/mysql”
DATADIR=”/usr/local/mysql/database”
PID=”${DATADIR}/mysql.pid”

# Disable networking
#SKIP=”–skip-networking”

# Start mysqld:
mysqld_start() {
# Remove stale pid file
if [ -r ${PID} ]; then
if ! ps ax | grep -v grep | egrep -q ‚mysqld’; then
echo „Cleaning up stale pid file: ${PID}”
rm -f ${PID}
fi
fi
${BASEDIR}/bin/mysqld_safe –user=mysql –datadir=${DATADIR} –pid-file=${PID} $SKIP &
}

# Stop mysqld:
mysqld_stop() {
# If there is no PID file, ignore this request…
if [ -r ${PID} ]; then
killall mysqld
# Wait at least one minute for it to exit, as we don’t know how big the DB is…
for second in $(seq 1 60); do
if [ ! -r ${PID} ]; then
break;
fi
sleep 1
done
if [ „$second” == „60” ]; then
echo „WARNING:  Gave up waiting for mysqld to exit!”
sleep 15
fi
fi
}

# Restart mysqld:
mysqld_restart() {
mysqld_stop
mysqld_start
}

case „$1” in
‚start’)
mysqld_start
;;
‚stop’)
mysqld_stop
;;
‚restart’)
mysqld_restart
;;
*)
echo „usage $0 start|stop|restart”
esac

# chmod +x /etc/init.d/rc.mysqld

Restartujemy MySQL

# /etc/init.d/rc.mysql restart

Sprawdzamy czy mozna się połączyć z baza danych

# mysql -u root -p

#######INSTALACJA APACHE##########

# cd /usr/src

Pobieramy i wypakowywujemy

# wget http://ftp.ps.pl/pub/apache/httpd/httpd-2.4.3.tar.bz2
# tar jxvf httpd-2.4.3.tar.bz2
# cd httpd-2.4.3
# ./configure --prefix=/usr/local/apache2
# make ; make install

Mamy apacha teraz kolej na PHP 5.3.5

########INSTALACJA PHP###########

Sciagamy:
– mcrypt

# cd /usr/src
# wget http://netcologne.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
# tar zxvf mcrypt-2.6.8.tar.gz
# cd mcrypt-2.6.8
# ./configure & make & make install

-Bcrypt (http://switch.dl.sourceforge.net/project/bcrypt/bcrypt/1.1/bcrypt-1.1.tar.gz)

# make & make install

-re2c (https://developers.googlecode.com/files/re2c-0.13.5.tar.gz)

# ./configure & make & make install

Przechodzimy do /usr/src, ściagamy php i rozpakowywujemy.

 # cd /usr/src
 # wget http://pl1.php.net/get/php-5.4.10.tar.bz2
 # tar jxvf php-5.4.10.tar.bz2
 # cd php-5.4.10

Konfiguracja

#./configure --prefix=/usr/local/php5 \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql --enable-mbstring\
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-sockets --with-mcrypt --without-pear \
--with-config-file-path=/usr/local/php5 \
--enable-ftp --with-zlib --enable-exif --with-gd \
--disable-debug --disable-rpath --disable-static \
--with-pic --with-layout=GNU --enable-calendar \
--enable-sysvsem --enable-sysvshm --enable-sysvmsg \
--enable-bcmath --with-bz2 --enable-ctype --with-db4 \
--with-iconv --with-gettext --enable-mbstring \
--enable-shmop --enable-wddx --enable-xml \
--with-xmlrpc --with-zlib --without-pgsql --without-mm \
--enable-gd-native-ttf --with-imap-ssl --enable-soap
 
 # ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib/libmysqlclient.so.18
 # ln -s /usr/local/mysql/lib/libmysqlclient.so /lib/libmysqlclient.so
 # ldconfig
 # make
 # make install

Włączamy w konfiguracji apache moduł php5

# vi /usr/local/apache2/conf/httpd.conf

Należy odhashować LoadModule

LoadModule php5_module        modules/libphp5.so

i dopisać index.php i index.php5

<IfModule dir_module>
DirectoryIndex index.html index.php index.php5
</IfModule>

W <IfModule mime_module> dopisujemy

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php5

Zapisujemy i startujemy MySQL i Apache

# /etc/init.d/rc.mysqld start
# /usr/local/apache2/bin/httpd

Serwery powinny wystartować.

To teraz wykonajmy test

#echo '<?php phpinfo(); ?>' >> /usr/local/apache2/htdocs/phpinfo.php

Wchodzimy na:
http://adres.serwera/phpinfo.php

Jak pokaże się strona wszystko działa jak należy.

Ostatnia część to instalacja phpmyadmin do obsługi bazy danych mysql.

#######Instalacja phpMyAdmin #########

# cd /usr/local/apache2/htdocs/
# wget http://freefr.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.5/phpMyAdmin-3.5.5-all-languages.tar.gz
# tar zxvf phpMyAdmin-3.5.5-all-languages.tar.gz
# mv phpMyAdmin-3.5.5-all-languages/ phpmyadmin/
# mv /usr/local/apache2/htdocs/phpmyadmin/config.sample.inc.php  /usr/local/apache2/htdocs/phpmyadmin/config.inc.php

Zmieniamy tajna frazę blowfish do phpmyadmin w pliku config.inc.php
Z:
$cfg[‚blowfish_secret’] = ‚a8b7c6d’;
NA:
$cfg[‚blowfish_secret’] = ‚twojehasło’;

http://adres.serwera/phpmyadmin

 

Opracował: Piotr Zieliński
___________________
centrale telefoniczne kraków

 

 

Add Comment

Required fields are marked *. Your email address will not be published.


*