Linux伺服器學習

2022-07-24 04:54:10 字數 3468 閱讀 4964

1、使用虛擬機器安裝,記憶體1g,硬碟最大100g,載入ios檔案版本: ubantu 14,安裝完成

我遇到了菱形亂碼問題,解決方案:

執行命令:vim /etc/default/locale

修改為:

lang="en_us.utf-8"

language="en_us:en"

2、安裝ssh 

sudo apt-get install openssh-server(由osc網友 火耳提供)

啟動命令:service ssh start  ,安裝完成後可以使用 xshell5連線 伺服器。

redis學習相關

1、安裝redis

開啟官網,右鍵複製redis包,如下圖

進入目錄,首先閱讀 readme.md 

可以使用make 命令安裝,如果make報錯,解決問題(apt-get install gcc),然後執行 make distclean 。之後繼續make 。 完成後可以執行 make prefix=/opt/bigdata/redis5 install  

然後設定環境變數:

vim /etc/profile 全域性環境變數

vim ~/.bashrc  個人環境變數

export redis_home=/opt/redis5

export path=$path:$redis_home/bin

source ~/.bashrc

拷貝以後,可以使用 原始碼包裡面的 utils/install_server.sh 安裝後端服務。  安裝完成後,就可以在 /etc/init.d/目錄下看到可執行service 。 

可以使用命令 servcie redis_6379 status 檢視狀態

修改配置檔案:/etc/redis  ,下面有 6379.conf 和6380.conf 

修改6379 ,注釋 # bind 127.0.0.1 ,然後修改  requirepass zlfredispwd  ,後面就是密碼。

然後就可以再**裡面用過 ip : 6379  ,  password:zlfredispwd   連線了

mysql 5.7  安裝

ubuntu 系統,直接執行: sudo apt-get install mysql-server

有的系統會直接彈出設定root密碼介面,設定即可。如果未彈出,則可以安裝完成後手動設定。

設定方法:使用命令mysql 進入mysql,

show databases;

use mysql;

update usersetauthentication_string=password("自定義密碼") where user='root';

update usersetplugin="mysql_native_password";

flush privileges;

quit;

然後重啟mysql   /etc/init.d/mysql restart;

設定遠端訪問:

mysql5.7 版本:

vi /etc/mysql/mysql.conf.d/mysqld.cnf;  //將bind-address = 127.0.0.1 修改成 bind-address = 0.0.0.0

mysql5.7以前的版本:

vi /etc/mysql/my.cnf;  //將bind-address = 127.0.0.1 修改成 bind-address = 0.0.0.0 ,或注釋掉即可

注釋 bind-address = 127.0.0.1

新建使用者

use mysql;

select host,user from user;(檢視現有使用者)

create user 'king'@'localhost' identified by '123456';(新建使用者);

select host,user from user;(再次檢視使用者)

賦許可權

grant all privileges on *.* to 'king'@'%' identified by '123456' with grant option;
flush privileges;
配置: /etc/mysql/my.cnf

命令目錄: /usr/bin 

修改密碼: /usr/bin/mysqladmin -u root password root123     , root123就是新密碼

修改密碼:

檢視字符集:

show variables like '%char%';

修改編碼:

[mysql]

#no-auto-rehash # faster start of mysql but no tab completition

default-character-set=utf8

[client] 下面也增加

default-character-set=utf8

[mysqld]

character_set_server=utf8

character_set_client=utf8

collation_server=utf8_general_ci

重啟生效,注意:修改只對後面建立的資料庫生效 

檢視支援引擎:show engines;

賦許可權給某使用者 某個庫的許可權, test_quick_collect為庫名, test_user為使用者名稱  「%」 代表不限制ip,也可以為ip段 。 「123qwe」 為密碼

grant select,insert,update,delete on test_quick_collect.* to test_user@'%' identified by '123qwe';

因在網路部署了mysql伺服器,目前沒有負載,本地連線的時候速度也正常,但就是通過網路連線的時候特別慢,最後檢查發現原來是dns解析的問題

在mysql的配置檔案/etc/my.cnf中的[mysqld]下加入

skip-name-resolve

重新啟動,測試速度正常。

使用linux定時任務:

service crond start 啟動定時任務

service crond status 檢視定時任務狀態

crontab -e 為當前使用者增加定時任務

伺服器安裝Linux伺服器

新辦公需要搭建一台伺服器,之前也沒有怎麼搞過,不過有一些了解,於是和同事一起嘗試安裝一下伺服器。本人使用ultraiso燒錄u盤,系統檔案是centos 6.6 x86 64 bin 1.ios,使用urtraiso開啟iso檔案,然後如下圖 接著就可以寫入,u盤會被格式化的,注意備份,等待寫入就可...

伺服器學習

安裝環境 apache 命令 etc init.d httpd start stop restart status apache開啟日誌 customlog usr local apache logs web.log combined配置ssl,阿里雲申請證書 在vhost新增配置 document...

Linux學習 伺服器B掛載伺服器A的資料夾

環境 centos 7.0 伺服器a 101,10.0.1 伺服器b 101.10.12.1 前提 保證伺服器a b都有 ifs data 資料夾 目的 在伺服器b上把伺服器a的 ifs data 資料夾掛載到自己的 ifs data 資料夾下。step1.編輯伺服器a的 etc exports檔案...