您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關(guān)openSUSE 12.1下如何搭建Web服務(wù)器的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。
1.開始說明
本教程中使用的IP地址是192.168.0.100,主機(jī)名稱為Server1.example.com 這些設(shè)置可能會(huì)有所不同,你需要根據(jù)不同情況進(jìn)行修改。
2.安裝MySQL5
首先我們需要先用下面的命令安裝MySQL5:
yast2 -i mysql mysql-client mysql-community-server
然后我們需要?jiǎng)?chuàng)建MySQL系統(tǒng)的啟動(dòng)鍵鏈接啟動(dòng)MySQL服務(wù)器,這樣以便于MySQL在系統(tǒng)啟動(dòng)時(shí)自動(dòng)啟動(dòng),
systemctl enable mysql.service systemctl start mysql.service
為了確保MySQL的安裝完成,運(yùn)行:
mysql_secure_installation
下面會(huì)遇到下面的提示問題;
server1:~ # 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: <-- 設(shè)置數(shù)據(jù)庫(kù)密碼 Re-enter new password: <-- 重新輸入數(shù)據(jù)庫(kù)密碼 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! server1:~ #
現(xiàn)在你的MySQL安裝應(yīng)成功了
3.openSUSE 12.1下安裝Apache2
Apache2的是作為一個(gè)openSUSE的軟件包,因此,我們可以用下面命令安裝它:
yast2 -i apache2
現(xiàn)在配置系統(tǒng)在引導(dǎo)時(shí)啟動(dòng)Apache
systemctl enable apache2.service
并啟動(dòng)Apache2
systemctl start apache2.service
現(xiàn)在,在您的瀏覽器輸入http://192.168.0.100,你應(yīng)該看到Apache2的首頁頁(不用擔(dān)心403錯(cuò)誤,這種情況,因?yàn)橛袥]有索引文件(例如index.html的文件根目錄)) :
錯(cuò)誤提示
Apache的默認(rèn)文檔根目錄是在openSUSE上的/srv/www/htdocs/目錄 ,配置文件是/etc/apache2/httpd.conf。配置存儲(chǔ)在的/etc/apache2/conf.d /目錄。
4.安裝PHP5
我們可以安裝PHP5和Apache的PHP5的模塊如下:
yast2 -i apache2-mod_php5
事后我們必須重新啟動(dòng)Apache:
systemctl restart apache2.service
5.測(cè)試PHP5并獲取PHP5的安裝信息
默認(rèn)網(wǎng)站的文件根目錄是在/srv/www/htdocs/中?,F(xiàn)在我們將在該目錄中創(chuàng)建一個(gè)小型PHP文件(info.php的)和在瀏覽器中調(diào)用它。該文件將顯示很多關(guān)于我們的PHP安裝,如安裝的PHP版本和有用的一些細(xì)節(jié)。
vi /srv/www/htdocs/info.php PHP設(shè)置
如果您得到的消息是你沒有一個(gè)有效的Vim安裝的二進(jìn)制軟件包。請(qǐng)安裝“VIM”,“vim的增強(qiáng)型”或者“gvim”,請(qǐng)運(yùn)行:
yast2 -i vim
安裝VI并再次嘗試。
現(xiàn)在,我們請(qǐng)?jiān)跒g覽器(如文件http://192.168.0.100/info.php):
PHP首頁
正如你所看到的,PHP5的工作,它通過Apache 2.0的處理程序,在服務(wù)器API線。如果你繼續(xù)向下滾動(dòng),你會(huì)看到所有在PHP5中已經(jīng)啟用的模塊。MySQL是沒有列出,這意味著我們沒有在PHP5支持MySQL。
6.獲得MySQL支持
讓PHP在MySQL中獲得支持,我們可以安裝的php5-mysql軟件包。安裝一些其他的PHP5模塊,以及您可能需要的應(yīng)用程序,這是一個(gè)好主意:
yast2 -i php5-mysql php5-bcmath php5-bz2 php5-calendar php5-ctype php5-curl php5-dom php5-ftp php5-gd php5-gettext php5-gmp php5-iconv php5-imap php5-ldap php5-mbstring php5-mcrypt php5-odbc php5-openssl php5-pcntl php5-pgsql php5-posix php5-shmop php5-snmp php5-soap php5-sockets php5-sqlite php5-sysvsem php5-tokenizer php5-wddx php5-xmlrpc php5-xsl php5-zlib php5-exif php5-fastcgi php5-pear php5-sysvmsg php5-sysvshm
現(xiàn)在重新啟動(dòng)Apache2的:
systemctl restart apache2.service
現(xiàn)在,重載http://192.168.0.100/info.php在您的瀏覽器,并再次向下滾動(dòng)到模塊部分?,F(xiàn)在,你應(yīng)該找到許多新的模塊,包括MySQL模塊:
MYSQL顯示
7. 安裝phpMyAdmin
phpMyAdmin是一個(gè)網(wǎng)絡(luò)接口,通過它可以管理你的MySQL數(shù)據(jù)庫(kù)。
phpMyAdmin的可安裝如下:
yast2 -i phpMyAdmin
為了確保我們稍后通過ISPConfig創(chuàng)建的所有網(wǎng)站訪問phpMyAdmin的可以和登錄使用phpmyadmin(http://www.example.com/phpmyadmin)和phpMyAdmin(如http://www.example.com/phpMyAdmin),打開/ etc/apache2/conf.d/phpMyAdmin.conf文件設(shè)置
vi /etc/apache2/conf.d/phpMyAdmin.conf
并開始添加以下兩個(gè)別名:
設(shè)置別名
重新啟動(dòng)Apache:
systemctl restart apache2.service
在地址欄輸入http://192.168.0.100/phpMyAdmin/:你就可以訪問phpMyAdmin了。
感謝各位的閱讀!關(guān)于“openSUSE 12.1下如何搭建Web服務(wù)器”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。