中文化
1 |
# yum groupinstall "chinese support" |
編輯設定檔,將 LANG 修改為 zh_TW.UTF-8
1 2 3 |
vi /etc/sysconfig/i18n LANG="zh_TW.UTF-8" |
需要重新開機方可生效。
—
安裝 Apache
安裝軟體 – 從光碟安裝
1 2 3 |
su – root 密碼 vi /etc/yum.repos.d/CentOS-Media.repo |
baseurl 設定增加光碟掛載路徑
1 |
baseurl=file:///media/CentOS_6.5_Final/ |
或是修改光碟掛載路徑
1 2 3 |
mkdir /media/cdrom mount /media/CentOS_6.5_Final mount /dev/cdrom /media/cdrom |
安裝 Apache HTTP Server
Apache 2.2.15
1 |
yum --disablerepo=\* --enablerepo=c6-media install httpd |
系統 → 管理 → 防火牆 →
1 |
chkconfig httpd on |
1 2 |
sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT sudo service iptables save |
- Samba
- SSH
- WWW (HTTP)
- 其他通訊埠,加入 8000 – 9000
系統 → 管理 → 服務
- Httpd
設定 httpd SELinux
所有自定義的網站資料夾皆需要重新設定
1 |
chcon -R -t httpd_user_content_t /WEBSite |
- Change the SELinux security context of each FILE to CONTEXT.
網路設定
1 2 3 4 5 6 7 8 9 |
vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none ONBOOT=yes TYPE=Ethernet IPADDR=192.168.0.5 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 |
—
名稱伺服器設定檔
1 2 3 4 |
vi /etc/resolv.conf nameserver 168.95.1.1 nameserver 8.8.8.8 |
—
主機名稱設定檔 /etc/sysconfig/network
1 2 |
NETWORKING=yes HOSTNAME=COS63 |
三、啟動網路與測試
1 |
service network restart |
—
安裝 PHP
php 5.3.3
1 |
yum --disablerepo=\* --enablerepo=c6-media install php php-* |
—
MySQL 資料庫
1 2 |
yum --disablerepo=\* --enablerepo=c6-media install mysql mysql-server service mysqld restart |
1 2 3 4 |
/usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password' /usr/bin/mysql_secure_installation |
1 2 |
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES; |
設定服務於每次開機啟動
1 |
chkconfig mysqld on |
—
Samba 檔案共用
1 2 |
yum --disablerepo=\* --enablerepo=c6-media install samba vi /etc/samba/smb.conf |
重新啟動 Samba 服務
1 |
/etc/rc.d/init.d/smb restart |
新增一般使用者,並且加入為 Samba 使用者
1 2 |
useradd user smbpasswd -a user |
—
修改 SELinux
1 |
setsebool -P samba_export_all_rw on |
- samba_export_all_ro : 只允許讀取
- samba_export_all_rw : 允許讀取和寫入
—
安裝 Extra Packages for Enterprise Linux (EPEL)
1 2 |
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh epel-release-6*.rpm |
1 2 |
gpg --quiet --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 yum install freetds |
–
phpMyAdmin
複製一份現成的比較快
1 2 3 4 5 6 7 8 |
Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/" <Directory "/usr/local/www/phpMyAdmin/"> Options none AllowOverride Limit Order Deny,Allow Deny from all Allow from 192.168.0.0/24 </Directory> |
—
上、下鍵搜尋指令
1 2 3 4 5 6 |
vi ~/.inputrc # Press up-arrow for previous matching command "\e[A":history-search-backward # Press down-arrow for next matching command "\e[B":history-search-forward |
—
vsftpd
設定開機啟動服務
1 |
chkconfig vsftpd on |
—
1)进入超级用户模式。
也就是输入”su -“,系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。(当然,你也可以直接用root用)
2)添加文件的写权限。
也就是输入命令”chmod u+w /etc/sudoers”。
3)编辑/etc/sudoers文件。
也就是输入命令”vim /etc/sudoers”,输入”i”进入编辑模式,找到这一 行:
“root ALL=(ALL) ALL” 在起下面添加”xxx ALL=(ALL) ALL”(这里的xxx是你的用户名),然后保存
1 2 3 4 5 6 |
mount -o loop CentOS-7.0-1406-x86_64-DVD.iso /mnt cd /mnt tar cvf - . | (cd /home/centos; tar xvf -) cd /; umount /mnt yum --disablerepo=\* --enablerepo=c6-media install lynx service sshd start |
—
MySQL 無法啟動
查看 mysqld.log
1 |
cat /var/log/mysqld.log |
得到
1 |
Version: '5.1.71' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution |
解決方法:刪除 /var/lib/mysql/mysql.sock 後重新啟動 MySQL 即可,每次當機都會造成一樣問題,不確定 FreeBSD 是否有相同問題,待測試。
—
PHP 開發
網頁發送 email
1 2 |
setsebool -P httpd_can_sendmail 1 setsebool -P httpd_can_network_connect 1 |
—
關閉 SELinux
1 2 3 4 5 6 7 8 9 |
vi /etc/selinux/config SELINUX=disabled # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. |
—
680 total views, 1 views today