国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > FreeBSD > 正文

Freebsd 6.0安裝配置Apache+MySQL+PHP+Myphpadmin+Webmin

2020-10-23 22:27:28
字體:
供稿:網(wǎng)友

一、安裝Freebsd

A、系統(tǒng)分區(qū)

很多人在使用自己的作業(yè)系統(tǒng)時,不知道如何對系統(tǒng)分區(qū),對于分區(qū)方案沒有最好的,只是跟據(jù)自己的情況去分。
下面是我的分區(qū)方案。

硬盤為120G ,/(根)1G 左右就差不多了,但考濾到/root 工作目錄也在這里,所以分大一點。

/home/data 主要是用來存放Email /ftp用戶的數(shù)據(jù)

/tmp 1G 也是考慮到臨時文件多,所以給大也點。

/usr/ 10G 因為要安裝軟件,還有下載的軟件,我沒有裝GUI 所以只分了10G我認為足夠了。

/var 3G這個目錄存放的東西比較多,如日志、郵件的臨時目錄,如果空間不夠amavisd-new 無法解開郵件進行殺毒。

 %df -h  Filesystem   Size    Used    Avail   Capacity   Mounted on  /dev/ad0s1a   1.9G   481M   1.3G    26%       /
devfs     1.0K    1.0K    0B      100%   /dev
/dev/ad0s1g    92G    353M    84G    0%     /home/data
/dev/ad0s1e    989M    224K    910M    0%    /tmp
/dev/ad0s1f    9.7G    1.8G    7.1G    20%    /usr
/dev/ad0s1d     2.9G   105M    2.6G     4%    /var

B、安裝基本系統(tǒng)

對于系統(tǒng)的安裝,我選擇了minimal(最小系統(tǒng))和ports ,因為有些沒必要的包就不裝,減少系統(tǒng)體積,

另外作為一臺服務(wù)器,我從來不裝GUI 。

下載BSD時,只需要下載DISK 1 就行了,缺少的軟件包可以通過網(wǎng)絡(luò)安裝。

C、配置系統(tǒng)

如果你在安裝后期沒有配置系統(tǒng),在系統(tǒng)啟動完成后以root的身份登陸系統(tǒng),運行sysinstall 進行設(shè)置,

或通過ee編輯器編輯/etc/rc.conf文件,在這里提醒各位,一會大多數(shù)服務(wù)都需要在/etc/rc.conf加入啟動內(nèi)容才能正常啟動。

設(shè)置好固定IP,或通過DHCP 自動分配置機器IP。使用SSH 客戶端進行管理服務(wù)器將會為你的工作提供方便。

使用SSH 要注意:

啟用 sshd

  sshd 的啟用是作為 FreeBSD 安裝中 Standard 安裝過程中的一步來進行的。 要查看 sshd 是否已被啟用, 請檢查 rc.conf 文件中的:

sshd_enable="YES"
 

  這表示在下次系統(tǒng)啟動時加載 OpenSSH 的服務(wù)程序 sshd(8)。 此外,也可以手動使用 rc(8) 腳本 /etc/rc.d/sshd 來啟動 OpenSSH

/etc/rc.d/sshd start

 

允許用戶登錄 AllowUsers 選項

  通常限制哪些用戶能夠登錄, 以及從何處登錄會是好主意。 采用 AllowUsers 選項能夠方便地達到這一目的。 例如, 想要只允許 root 用戶從 192.168.1.32 登錄, 就可以在 /etc/ssh/sshd_config 文件中加入下述設(shè)置:

AllowUsers root@192.168.1.32

  要允許用戶 admin 從任何地方登錄, 則只需列出用戶名:

AllowUsers admin

  可以在同一行指定多個用戶, 例如:

AllowUsers root@192.168.1.32 admin

注意: 列出需要登錄機器的用戶很重要; 否則他們將被鎖在外面。

  在完成對 /etc/ssh/sshd_config 的修改之后您必須告訴 sshd(8) 重新加載其配置文件, 方法是執(zhí)行:

#				/etc/rc.d/sshd reload

 

a、不能用root直接登陸,需要添加一個新用戶,指定到wheel 組,用此用戶登陸后用使用 su - 提升到管理員。

b、 以我的SecureCRT 為例,Session options ->Authentication ->Primary 選擇keyboard Interactive

c、如果你要使用像LINUX 一樣的彩色顯示,需要把 Emulation -> Terminal ->Xterm 選中ANSI Color 并在/etc/csh.cshrc加入

 

setenv LSCOLORS ExGxFxdxCxegedabagExEx setenv CLICOLOR yes
set autolist

然后執(zhí)行

 

sed -i.bak -E s/set/ prompt/#set/ prompt/g /root/.cshrc

退出重新登陸即可看到彩色目錄了。

二、更新軟件包

采用Freebsd 最好的地方就是安裝軟件方便,還可以裝到最新的軟件包,這就是強大的posts 系統(tǒng)。如果你的系統(tǒng)在安裝時沒有選擇posts ,具休如何操作看BSD 的handbook.

對ports 進行更新,首先修改系統(tǒng)默認下載的FTP地址:

#vi /etc/make.conf

添加下列四個連接地址,第一個為HTTP連接其余都是FTP.

MASTER_SITE_OVERRIDE?= /
http://ports.hshh.org/${DIST_SUBDIR}/ /
ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/ /
ftp://ftp.tw.freebsd.org/pub/ports/distfiles/${DIST_SUBDIR}/ /
ftp://freebsd.csie.nctu.edu.tw/pub/ports/distfiles/${DIST_SUBDIR}/ /

CVSUP 的站點很多,你可以選擇離你最快的站點去更新posts ,具體查看 freebsd.org /freebsdchina.org.cn

在使用cvsup之前你必須連接到互聯(lián)網(wǎng),并需要安裝cvsup 這個軟件

a、安裝cvsup-without-gui

 

 % cd /usr/ports/net/cvsup-without-gui/ % make install clean 

b、更新ports
安裝完cvsup軟件后,

 

% /usr/local/bin/cvsup -gL 2 -h cvsup4.freebsdchina.org /usr/share/examples/cvsup/ports-supfile

三、安裝數(shù)據(jù)庫 MySQL

 

MySQL 版本很多,大家可以據(jù)自己需要自行安裝。

%cd /usr/ports/databases/mysql41-server/%make install clean

在/etc/rc.conf 加入

mysql_enable="YES"

復制配置文件(非必需)

cp /usr/local/share/mysql/my-small.cnf /usr/local/etc/my.cnf

在此說明:

1、如果不在/etc/rc.conf 加入以上內(nèi)容,手工是無法啟動MySQL的。
2、如果你想知道這個軟件應(yīng)該在/etc/rc.conf加入什么內(nèi)容,

打開/usr/local/etc/rc.d 目錄,找到此軟件的啟動腳本。然后打開文件,如果有詳細的說明。

%/usr/local/etc/rc.d/mysql-server.sh start Starting mysql.

如何去檢查一個服務(wù)是否正常啟動:1、通過ps查看進程,2、檢查所打開的端口。

%ps aux|grep mysqlmysql 94899  0.2  0.5  1644  1240  p0  S     3:52PM   0:00.07 /bin/sh /usr/local/bin/mysqld_safe --mysql 94919  0.0 10.8 55564 27428  p0  S     3:52PM   0:01.54 /usr/local/libexec/mysqld --defaults-%%netstat -an|grep 3306tcp4       0      0  *.3306                 *.*                    LISTEN

MySQL安裝時,服務(wù)器的密碼為空,建議你裝好系統(tǒng)后,第一時間去更改密碼。

% /usr/local/bin/mysqladmin -u root -p password 你的新密碼 Enter password: 

如果你服務(wù)器只供本站內(nèi)部使用建議在 my.cnf 里加入下面內(nèi)容,以增加服務(wù)器的安全性。

[mysqld]bind_address=127.0.0.1
 

四、安裝Apache

 

1、安裝apache server

作為網(wǎng)絡(luò)的今天apache web服務(wù)器已經(jīng)是街知港聞了。
% cd /usr/ports/www/apache22/% make install clean
 
     │                     Options for python 2.4.3                       │
     │ │ [X] THREADS          Enable thread support                     │ │
     │ │ [ ] HUGE_STACK_SIZE  Use a larger thread stack                 │ │
     │ │ [X] UCS4             Use UCS4 for unicode support              │ │
     │ │ [X] PYMALLOC         Use python's internal malloc              │ │
     │ │ [ ] IPV6             Enable IPv6 support                       │ │
     │ │ [ ] FPECTL           Enable floating point exception handling
 

在/etc/rc.conf 中加入:

apache22_enable="YES"

如果啟動時出現(xiàn)httpd: Could not reliably determine the

server's fully qualified domain name, using mail.sharesky.cn for ServerName 的錯誤,

在/usr/local/etc/apache22/httpd.conf 約第144行的位置加入下面的內(nèi)容。

ServerName mail.extmail.org

啟動apahce

% /usr/local/etc/rc.d/apache22.sh startPerforming sanity check on apache22 configuration:Syntax OKStarting apache22.

2、安裝PHP

% cd /usr/ports/www/mod_php4/% make install clean
                  Options for mod_php4 4.4.2_1,1                    x                 x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x                 x x         [ ] DEBUG      Enable debug                            x x                 x x         [X] MULTIBYTE  Enable zend multibyte support           x x                 x x         [ ] IPV6       Enable ipv6 support                     x x                 x x         [X] OPENSSL    Build static OpenSSL extension       

在/usr/local/etc/apache22/httpd.conf 里加入

AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps

加入目錄索引 index.php,約在httpd.conf 的212行

 DirectoryIndex index.html index.php

restart或reload Apache 使之生效

% /usr/local/etc/rc.d/apache22.sh reloadPerforming sanity check on apache22 configuration:Syntax OKPerforming a graceful restart

3、安裝PHP 擴展

% cd /usr/ports/lang/php4-extensions/% make install clean
在這里建議大家,如果沒有必要盡量不要安裝GD庫免得浪費時間,大家可據(jù)自己需要選擇安裝模塊
               lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk               x                 Options for php4-extensions 1.0                    x                 x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x                 x x  [ ] BCMATH       bc style precision math functions            x x                 x x  [X] BZ2          bzip2 library support                        x x                 x x  [ ] CALENDAR     calendar conversion support                  x x                 x x  [ ] CRACK        crack support                                x x                 x x  [X] CTYPE        ctype functions                              x x                 x x  [X] CURL         CURL support                                 x x                 x x  [ ] DBA          dba support                                  x x                 x x  [ ] DBASE        dBase library support                        x x                 x x  [ ] DBX          dbx support                                  x x                 x x  [ ] DIO          Direct I/O support                           x x                 x x  [ ] DOMXML       DOM support                                  x x                 x x  [ ] EXIF         EXIF support                                 x x                 x x  [ ] FILEINFO     fileinfo support                             x x                 x x  [ ] FILEPRO      filePro support                              x x                 x x  [ ] FRIBIDI      FriBidi support     			     x x  [X] FTP          FTP support                                  x x                 x x  [ ] GD           GD library support                           x x                 x x  [X] GETTEXT      gettext library support                      x x                 x x  [ ] GMP          GNU MP support                               x x                 x x  [X] ICONV        iconv support                                x x                 x x  [ ] IMAGICK      ImageMagick support                          x x                 x x  [X] IMAP         IMAP support                                 x x                 x x  [ ] INTERBASE    Interbase 6 database support (Firebird)      x x                 x x  [ ] LDAP         OpenLDAP support                             x x                 x x  [X] MBSTRING     multibyte string support                     x x                 x x  [ ] MCAL         Modular Calendar Access Library support      x x                 x x  [X] MCRYPT       Encryption support                           x x                 x x  [ ] MCVE         MCVE support                                 x x                 x x  [ ] MHASH        Crypto-hashing support                       x x  			     x x  [ ] MING         ming shockwave flash support                 x x                 x x  [ ] MNOGOSEARCH  mnoGoSearch support                          x x                 x x  [ ] MSSQL        MS-SQL database support                      x x                 x x  [X] MYSQL        MySQL database support                       x x                 x x  [ ] NCURSES      ncurses support (CLI only)                   x x                 x x  [ ] ODBC         unixODBC support                             x x                 x x  [X] OPENSSL      OpenSSL support                              x x                 x x  [ ] ORACLE       Oracle support                               x x                 x x  [X] OVERLOAD     user-space object overloading support        x x                 x x  [ ] PANDA        panda support                                x x                 x x  [ ] PCNTL        pcntl support (CLI only)                     x x                 x x  [X] PCRE         Perl Compatible Regular Expression support   x x                 x x  [ ] PDF          PDFlib support (implies GD)                  x x                 x x  [ ] PFPRO        PayFlow Pro support                          x x  			     x x  [ ] PGSQL        PostgreSQL database support                  x x                 x x  [X] POSIX        POSIX-like functions                         x x                 x x  [ ] PSPELL       pspell support                               x x                 x x  [ ] READLINE     readline support (CLI only)                  x x                 x x  [ ] RECODE       recode support                               x x                 x x  [X] SESSION      session support                              x x                 x x  [ ] SHMOP        shmop support                                x x                 x x  [ ] SNMP         SNMP support                                 x x                 x x  [ ] SOCKETS      sockets support                              x x                 x x  [ ] SYBASE_CT    Sybase database support                      x x                 x x  [ ] SYSVMSG      System V message support                     x x                 x x  [ ] SYSVSEM      System V semaphore support                   x x                 x x  [ ] SYSVSHM      System V shared memory support               x x                 x x  [X] TOKENIZER    tokenizer support                            x x  			     x x  [ ] WDDX         WDDX support (implies XML)                   x x                 x x  [X] XML          XML support                                  x x                 x x  [ ] XMLRPC       XMLRPC-EPI support                           x x                 x x  [ ] XSLT         XSLT Sablotron support                       x x                 x x  [ ] YAZ          YAZ support (ANSI/NISO Z39.50)               x x                 x x  [ ] YP           YP/NIS support                               x x                 x x  [ ] ZIP          ZIP support                                  x x                 x x  [X] ZLIB         ZLIB support                                 x x  
 
 
# vi /usr/local/www/apache22/data/test.php 
輸入:
<?php phpinfo(); ?>

 

4、安裝phpmyadmin 管理數(shù)據(jù)庫

為了去除無聊的安裝過程,這里選擇手工安裝,先下載軟件包,然后解壓,再復制到/usr/local/www/apache22/data 下面

%cd /usr/ports/databases/phpmyadmin/%make fetch%cd /usr/ports/distfile%tar jxvf phpMyAdmin-2.7.0-pl2.tar.bz2%cp -r /usr/ports/distfiles/phpMyAdmin-2.7.0-pl2 /usr/local/www/apache22/data/phpmyadmin
%cd /usr/local/www/apache22/data/phpmyadmin/%ee config.default.php 

將$cfg['Servers'][$i]['auth_type'] = 'config'; 改為

$cfg['Servers'][$i]['auth_type']     = 'http'; 
打開頁面彈出驗證窗口。

打開http://ip/phpmyadmin 就可以管理你的mysql 數(shù)據(jù)庫了

推出保存#chmod 755 test.php
大家注意,可能你下載的版本與我下載的不一樣,不能照搬。設(shè)置phpmyadmin phpMyAdmin-2.8.1 版的Port 安裝方法.# whereis phpmyadmin
phpmyadmin: /usr/ports/databases/phpmyadmin
cd /usr/ports/databases/phpmyadminmake install clean #cd /usr/local/www/phpMyAdmin/進入phpmyadmin下的libraries 目錄!修改 config.default.php#vi libraries/config.default.php
找到$cfg['PmaAbsoluteUri'] = '';
修改成 $cfg['PmaAbsoluteUri'] = 'http://你的IP/phpmyadmin';
找到
$cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user']          = 'root';      // MySQL user
$cfg['Servers'][$i]['password']      = '';
寫上你的Mysql用戶名and密碼!保存退出!
因為phpmyadmin的PATH 是:/usr/local/www/phpmyadmin所以我們需要在APACHE里面建立一個Alias:#vi /usr/local/etc/apache22/httpd.conf在Alias 組加入下列內(nèi)容:***************************************************        Alias /phpmyadmin "/usr/local/www/phpMyAdmin/"
    <Directory /usr/local/www/phpMyAdmin/>
    Order allow,deny
    Allow from all
    </Directory>***************************************************
保存退出.
彈出驗證窗口。修改/usr/local/www/phpMyAdmin/libraries/config.default.php中的:$cfg['Servers'][$i]['auth_type']     = "config"改成: $cfg['Servers'][$i]['auth_type']     = 'http';   # /usr/local/etc/rc.d/apache22.sh reload 然后用http://your IP/phpmyadmin訪問!

5 使用同一個IP的虛擬主機設(shè)置方法:

取消中心主機,在ServerName 前面加井號屏蔽. 

添加虛擬主機設(shè)置,比如說,假設(shè)你正在為域名www.domain.tld提供服務(wù), 而你又想在同一個IP地址上加一個名叫www.otherdomain.tld的虛擬主機, 你只需在httpd.conf中加入以下內(nèi)容:

NameVirtualHost *

<VirtualHost *>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>

和添加別名是雷同的.

6 安裝WEBMIN

mail# whereis webmin
webmin: /usr/ports/sysutils/webmin
cd /usr/ports/sysutils/webmin

make install clean

cd /usr/local/etc/webmin

sh start

然后訪問 http://IP:10000

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 宜都市| 如东县| 抚州市| 榕江县| 南平市| 盐边县| 盖州市| 辉南县| 清远市| 平江县| 锡林浩特市| 巴东县| 宝坻区| 许昌县| 杭锦旗| 崇左市| 轮台县| 密云县| 乐东| 枣强县| 永清县| 固原市| 抚顺市| 五莲县| 怀集县| 尼玛县| 巴林左旗| 合川市| 安多县| 泸水县| 同仁县| 阜新| 旬阳县| 河源市| 历史| 大化| 邮箱| 酒泉市| 康定县| 含山县| 准格尔旗|